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?

2
  • Something like this askubuntu.com/questions/429247/… ?
    – TuKsn
    May 30, 2014 at 9: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, 2014 at 9:56

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .