How to Find Symbolic Links in Ubuntu Linux

The Symlink Audit

A symbolic link (symlink) in Linux acts exactly like a desktop shortcut in Windows; it is a tiny file that simply points the operating system to another file or directory located elsewhere on the hard drive. While incredibly useful for organizing web server directories (like linking /var/www/html to a specific user’s home folder), symlinks can become a massive security risk or organizational nightmare if you forget where they are. A broken symlink points to a file that no longer exists, causing software to crash. To audit your filesystem, you must instruct the kernel to find these specific “pointer” files while ignoring actual, physical data.

Using the find Command with -type l

The Linux find command utilizes the -type l flag (lowercase ‘L’ for Link) to filter searches exclusively for symbolic links.

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. To search a specific directory, such as the entire Apache web directory, type the following command exactly:
  3. sudo find /var/www/ -type l
  4. Press Enter and provide your administrator password.

Analyzing the Output

The terminal will output a list of every symbolic link found within that directory path. However, simply knowing the link exists is usually not enough; you need to know exactly where the link is pointing. To reveal the hidden destination paths, append the -exec ls -l command to your search:

sudo find /var/www/ -type l -exec ls -l {} +

This command finds every symlink and instantly passes it to the list command, which will print a beautiful, readable output showing the exact symlink name followed by an arrow (->) pointing directly to its final destination on the hard drive.

Get the best tech tips delivered straight to your inbox.

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