Mac Terminal command to get the full path of a file

·

1 min read

I was searching for a command to get the full path of a file in Mac Terminal. In Linux, I know it is readlink -f <filename>. But that didn't work for me on Mac. The equivalent command in Mac is greadlink -f <filename>. For this command to work, you must install coreutils package first, which contains the greadlink (GNU readlink) command. To install coreutils package, just run the command brew install coreutils on terminal.