Readlink
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
- link - Make hard links.
- ln - Make hard or soft links
- mkdir - Make directory nodes.
- mkfifo - Make a named pipe directory entry (aka fifo)
- mknod - Make a device node, or a socket node.
- rmdir - Remove empty directories.
- unlink - Remove directory entries (other than for subdirectories)
See also
- Another man page of readlink
- awk - Scan and process patterns in text.
- User's Guide of GNU Awk (online or downloadable)
This article is a stub and needs to be finished. Plunge forward and help it grow!