Getting the absolute path of a file in Linux is a common task, and there are several ways to do it depending on whether the file is in your current directory or somewhere else on the system.
| Goal | Command |
| Resolve links and relative paths | realpath <file> |
| Simple path expansion | readlink -f <file> |
| Find file by name and get path | find $(pwd) -name <file> |
| Locate an installed program | which <program> |