1

i want to know how to find if a certain file has a symbolic link to another file?

the LN command

# ln -s /etc/kannel.conf /etc/kannel/kannel.conf

how to confirm this symbolic link?

ziro_axis
  • 61
  • 1
  • 1
  • 3
  • Something like this http://askubuntu.com/questions/429247/how-to-find-and-list-all-the-symbolic-links-created-for-a-particular-file ? – TuKsn May 30 '14 at 09:27
  • 1
    What do you mean confirm it? If you know the name of the link, `ls -l /etc/kannel/kannel.conf` will show you if it exists and what it links to. Finding all links to a target when you only know the target is a different question, which one do you need? – terdon May 30 '14 at 09:56

1 Answers1

0

Use test command.

pastas@ubuntan:~/tmp$ ls -alth
total 16K
drwxrwxr-x 2 pastas pastas 4.0K Dec 16 17:18 .
lrwxrwxrwx 1 pastas pastas    9 Dec 14 18:34 robot.cpp_2 -> robot.cpp
-rw-rw-r-- 1 pastas pastas  106 Dec 14 16:13 robot.cpp
pastas@ubuntan:~/tmp$ test -L robot.cpp_2 && echo "sym" || echo "not sym"
sym
pastas@ubuntan:~/tmp$ test -L robot.cpp && echo "sym" || echo "not sym"
not sym
IsaacS
  • 1,106
  • 5
  • 17
  • 40