Steven You

A Forged Geek.

Bash Command Line Get File Absolute(canonical) Path

To print absolute path to a file:

$ readlink -m <file>

or use python script:

import sys
import os
for path in sys.argv[1:]:
    print os.path.realpath(path)

or use bash:

echo $(cd $(dirname $1); pwd)/$(basename $1)

Comments