The Shortcut Audit
In Ubuntu Linux, symbolic links (symlinks) function exactly like desktop shortcuts in Windows. They are tiny placeholder files that point the operating system to a completely different folder or file located elsewhere on the hard drive. While symlinks are essential for organizing complex server environments (such as pointing a web server to a specific configuration directory), they can easily become broken or “orphaned” if the original target file is moved or deleted. If you need to map out your server’s architecture or clean up broken links, you must instruct the Linux search engine to filter exclusively for these specific shortcut files.
Using the find Command with -type l
The Linux find command utilizes the -type l (link) flag to instantly isolate all symbolic links, ignoring standard files and physical directories.
- Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
- To search the entire
/etc/directory specifically for symbolic links, type the following command exactly: sudo find /etc/ -type l- Press Enter and provide your administrator password.
Finding Broken Links
If your goal is to clean up a messy filesystem, you can append an additional flag to find only the links that are completely broken (pointing to a file that no longer exists). Running sudo find /etc/ -type l ! -exec test -e {} \; -print will force the search engine to evaluate every single symlink and only output the ones that lead to a dead end, allowing you to quickly delete them and restore order to your server.