readlink
Print the target of a symbolic link or the canonical file path.
Synopsis
readlink [OPTION]... FILE...
Examples
readlink /usr/bin/python
readlink -f ./relative/path
readlink -e /some/link
Common options
| Flag | Description |
|---|---|
| -f | Canonicalize by following every symlink, all components must exist |
| -e | Like -f but all components must exist |
| -m | Canonicalize without requiring existence |
| -n | Do not print trailing newline |
About readlink
The `readlink` command print the target of a symbolic link or the canonical file path. File operation commands are essential for navigating and managing the Linux filesystem.
They form the backbone of everyday system administration and development workflows. Mastering these commands enables you to efficiently create, move, copy, and organize files and directories from the terminal, which is often faster and more scriptable than graphical alternatives.
The command accepts 4 commonly used flags shown above, though the full set of options is available in the man page (`man readlink`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More File Operations Commands
Other commands in the File Operations category