A symbolic link, also known as a soft link, is a type of pointer that points to the location of a folder or file on your system. Some of these links are created on your system by default, while you can manually create symbolic links yourself for any files or folders you want. This article will tell you the different methods you can use to list all symbolic links on Linux. I used Linux Mint 20 for this guide, but the same steps work on any Linux distribution.
Three ways to list symbolic links on Linux
To list all the symbolic links in Linux Mint 20 based on your exact needs, you can choose one of the following three methods:
Method 1: Finding all symbolic links of the current filesystem:
If you want to list all of the symbolic links of your current filesystem in Linux Mint 20, you can do so by running the command shown below:
$ sudo find / -type l
This variation of the “find” command will take a reasonable amount of time because it will have to traverse your entire filesystem to find all of the symbolic links it contains. Once executed, you can see a very long list of all the symbolic links in your current file system, as shown in the following figure:
Method # 2: Find all symbolic links of the current working directory
Now if you want to find all of the symbolic links of your current working directory, you can do so by running the command shown below:
$ sudo find . -type l
This command runs relatively quickly, after which you can see a list of all the symbolic links in your current working directory, as shown in the following figure:
Method # 3: Finding All the Symbolic Links in a Specific Directory
You can even list all the symbolic links of a particular directory using the following command:
$ sudo find DirectoryName -type l
You must replace DirectoryName with the name of the directory whose symbolic link you want to find along with its full path.
This command will also run immediately after which you can see a list of all the symbolic links of your specified directory, as shown in the following figure:
Depending on your usage requirements, you can choose one of the three methods described in this article to list all the symbolic links on your system. All of these methods are based on one-line commands, so you can run them very quickly.