Show All Symbolic (Soft) Links

ls -l | grep ^l
Shows all linked file and destinations. The 'ls -l' command lists the files in long (1 file per line) format, and the grep command displays only those lines that starts with an l (lower case L) -- a linked file. Updated: Remove reference to hard links because this command does not apply to hard link as others kindly pointed out.
Sample Output
$ ll | grep ^l
lrwxrwxrwx  1    4 Aug 26  2008 awk -> gawk*
lrwxrwxrwx  1    3 Aug 26  2008 bsh -> ash*
lrwxrwxrwx  1    4 Aug 26  2008 csh -> tcsh*

-6
By: haivu
2009-04-02 17:47:36

What Others Think

Does not show hard linked files
citybadger · 550 weeks and 5 days ago
Hard links are not a link file type. The are regular files. As such, your command will only show you soft, or symbolic links. echo foo > foo.txt ln foo.txt bar.txt ls -l bar.txt
atoponce · 550 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: