Date: 2012nov16
Update: 2025aug21
OS: Linux
Language: bash
Q. Linux: 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 then 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:
cd /dev; ls -lF | grep -- '->'
Produces:
lrwxrwxrwx 1 root root 11 Apr 16 06:03 core -> /proc/kcore
lrwxrwxrwx 1 root root 13 Apr 16 06:03 fd -> /proc/self/fd/
lrwxrwxrwx 1 root root 12 Apr 16 10:03 initctl -> /run/initctl|
lrwxrwxrwx 1 root root 28 Apr 16 06:03 log -> /run/systemd/journal/dev-log=
lrwxrwxrwx 1 root root 4 Apr 16 10:03 rtc -> rtc0
lrwxrwxrwx 1 root root 15 Apr 16 06:03 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Apr 16 06:03 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Apr 16 06:03 stdout -> /proc/self/fd/1|