Original address: http://blog.csdn.net/liangxiaozhang/article/details/7356829
Readlink is a common tool used in Linux systems, primarily to find out where symbolic links are pointing.
Execute the following command in the Ubuntu system:
[Plain]View Plaincopy
- $ readlink--help
You can view the Help information for the Readlink command, or perform
[Plain]View Plaincopy
- $ mans Readlink
View the Help manual.
A description of the purpose of the Readlink command can be obtained from the Help information:
Output symbolic link value or authoritative file name
English is:
Print value of a symbolic link or canonical file name
Example:
In the end, which executable file does the awk command in the system execute?
[Plain]View Plaincopy
- $ readlink/usr/bin/awk
- /etc/alternatives/awk----> Actually, this is still a symbolic connection.
- $ readlink/etc/alternatives/awk
- /usr/bin/gawk----> This is the real executable file.
- f option:
The-f option can recursively follow all symbolic links that give a file name to standardize, except for the last one, all components must exist.
To put it simply, it is to follow the symbolic link until the file location of the non-symbolic link, the limit is the last file that must exist for a non-symbolic link.
[Plain]View Plaincopy
- $ readlink-f/usr/bin/awk
- /usr/bin/gawk
Readlink commands in Linux