How to show full path of a file including the full filename in Mac OSX terminal?

From here: https://stackoverflow.com/a/4031502/804713

macports and homebrew provide a coreutils package containing greadlink (GNU readlink). credit to Michael Kallweitt post in mackb.com

brew install coreutils

greadlink -f file.txt


There are many ways to do that; here is one example that may work for you:

claw:~ jonv$ echo `pwd`/`ls config.in.php`
/Users/jonv/config.in.php

If you want more examples, there are a bunch on this post at stackoverflow.


In Mac OSX, do the following steps:

  1. cd into the directory of the target file.
  2. Type either of the following terminal commands.
Terminal
ls "`pwd`/file.txt"
echo $(pwd)/file.txt
  1. Replace file.txt with your actual file name.
  2. Press Enter.