Linux / UNIX find files with symbolic links

Linux / UNIX find files with symbolic links

To find all files that are symbolic links (symlinks) in a directory and its subdirectories on a Linux or Unix system, you can use the find command with the -type option and the l option.

For example, to find all symlinks in the current directory and its subdirectories, you can use the following command:

find . -type l
So‮u‬rce:www.lautturi.com

This command will search the current directory and its subdirectories for files that are symbolic links and print their names to the console.

To find symlinks that point to a specific file or directory, you can use the -lname option and specify the target file or directory. For example, to find all symlinks that point to the file /etc/passwd, you can use the following command:

find . -type l -lname "/etc/passwd"

You can also use the -ls option to display more information about the symlinks, such as their ownership, permissions, and target paths. For example:

find . -type l -ls

For more information about using the find command to locate files on a Linux or Unix system, you can consult the find documentation or seek assistance from a qualified administrator.

Created Time:2017-10-29 22:08:55  Author:lautturi