Readlink

From LQWiki
Jump to navigation Jump to search

Readlink shows the destination of a symbolic link. For instance, if one has a file named "lsc" which links to "/bin/ls":

$ readlink lsc
/bin/ls

A command that this author has frequently found useful is:

$ readlink filename | awk -F/ '{ print $NF }'

This will print the filename of the file to which the link is pointing. To find the name of the driver of your ethernet card, for example:

$ readlink /sys/class/net/eth0/driver | awk -F/ '{ print $NF }'

Provided by

Most (all?) Linux distributions incorporate this from the GNU Coreutils: man page

Related Commands

See also

This article is a stub and needs to be finished. Plunge forward and help it grow!