pwd with file name

I often am working with a file and need to copy it’s full absolute path. In the past, I always used pwd to grab the path, then typed a slash then ls’d the file name and copied that. I just stumbled across the realpath command which allows you to do this all in one step for quick copying/pasting of the absolute path.

readlink -f somefile.txt

which outputs:

/full/path/to/that/file/somefile.txt

It’s the little things!

Leave a Reply

Your email address will not be published. Required fields are marked *