How to Find All Symbolic Links in Ubuntu Linux Using the find Command

The Maze of Symbolic Links

In Ubuntu Linux, symbolic links (symlinks) act like advanced “shortcuts.” They are small files that do not contain data themselves but simply point to another file or directory located elsewhere on the hard drive. While incredibly useful for configuring software without moving massive installation folders, symlinks can easily get out of hand. If you delete the original target file, the symlink remains behind as a “broken link,” pointing to nothing. If you are cleaning up a messy web server directory or trying to map out a complex software installation, you need to be able to instantly locate every single symbolic link within a specific folder hierarchy without manually clicking through hundreds of directories.

Using the find Command for Symlinks

The standard Linux find command can easily isolate symbolic links by using the -type l (lowercase L) flag.

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. Determine the directory you want to scan. For this example, we will search the /etc/ directory, which heavily utilizes symlinks for configuration files.
  3. Type the following command:
  4. find /etc/ -type l
  5. Press Enter.

Understanding the Output

The command will instantly print a list of raw file paths. However, this basic output is not very helpful because it doesn’t tell you where the symlink is actually pointing. To see the target destination, you should pipe the results into the ls command.

  1. Run the command again, but format it like this:
  2. find /etc/ -type l -exec ls -l {} +

Now, the terminal will display a beautifully formatted list. You will see the permissions, the owner, and crucially, an arrow syntax (e.g., nginx.conf -> /opt/nginx/conf/main.conf). This clearly shows you the exact name of every symbolic link on the left side of the arrow, and the exact, absolute path of the hidden target file on the right side of the arrow.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.