Jean Jean - 4 months ago 14
Linux Question

How to get full path of a file?

Is there an easy way I can print the full path of

file.txt
?

file.txt = /nfs/an/disks/jj/home/dir/file.txt


The
<command>


dir> <command> file.txt


should print

/nfs/an/disks/jj/home/dir/file.txt

Answer

Use readlink:

readlink -f file.txt
Comments