Getting File's Full Path in Ubuntu | Generated by AI

Home PDF

In Ubuntu, you can get the full path of a file using the realpath or readlink -f command. For your example with geckodriver, you can run:

realpath ./geckodriver

or

readlink -f ./geckodriver

Both will output the full path, e.g.:

/home/lzw/bin/geckodriver

The realpath command is straightforward and commonly used for this purpose. If realpath is not installed, you can install it with:

sudo apt install realpath

Alternatively, readlink -f is usually available by default as part of coreutils.


Back 2025.06.21 Donate