How to list all symbolic links in a directory

Parsing ls is a Bad Idea®, prefer a simple find in that case:

find . -type l -ls

To only process the current directory:

find . -maxdepth 1 -type l -ls

Credits: How do I make the shell to recognize the file names returned by a `ls -A` command, and these names contain spaces?


You can use grep with ls command to list all the symbolic links present in the current directory.

This will list all the links present in the current directory.

ls -la /var/www/ | grep "\->"

grep is your friend:

ls -lhaF | grep ^l   # list links
ls -lhaF | grep ^d   # list directories
ls -lhaF | grep ^-   # list files

This will list lines starting with "l" which represent Links in the perms column in place of l use d for directories and - for files