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 回答1: Use readlink: readlink -f file.txt 回答2: I suppose you are using Linux. I found a utility called realpath in coreutils 8.15. realpath file.txt /data/ail_data/transformed_binaries/coreutils/test_folder_realpath/file.txt As per @styrofoam-fly and @arch-standton comments, realpath alone doesn't check