Dave's Brain

Browse - Computer Tips - How can I show the symbolic links in a folder?

Date: 2012nov16
OS: Linux

Q.  How can I show the symbolic links in a folder?

A.  This is one way:

ls -lF | grep -- '->'
The -l and -F options for ls cause symlinks to have -> displayed. We use grep to show only those lines. This is for the current directory. When I run that command in the /dev folder I see the links that udevd made:
lrwxrwxrwx 1 root root 3 Nov 11 16:09 cdrom -> sr0 lrwxrwxrwx 1 root root 11 Nov 11 16:09 core -> /proc/kcore lrwxrwxrwx 1 root root 13 Nov 11 16:09 fd -> /proc/self/fd/ lrwxrwxrwx 1 root root 13 Nov 11 16:09 MAKEDEV -> /sbin/MAKEDEV* lrwxrwxrwx 1 root root 4 Nov 11 16:09 rtc -> rtc0 lrwxrwxrwx 1 root root 15 Nov 11 16:09 stderr -> /proc/self/fd/2 lrwxrwxrwx 1 root root 15 Nov 11 16:09 stdin -> /proc/self/fd/0 lrwxrwxrwx 1 root root 15 Nov 11 16:09 stdout -> /proc/self/fd/1|

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.