Skip to main content

Getting the full path of a file or folder in Linux

· By Andrej Friesen · 1 min read

I often needed to copy the full path from a file or folder when I was somewhere deep in the file system.

I always run pwd to get the current directory path, copied the string, pasted it somewhere, and then add the file or folder name behind.

This was kind of was annoying and looks like there is a handy tool for that: readlink -f

$ pwd
/home/andrej/syncthing

$ ls
notes

$ readlink -f notes/
/home/andrej/syncthing/notes

Tada, you can now directly copy that string in your clipboard and go nuts.

About the author

Andrej Friesen Andrej Friesen
Updated on Jul 16, 2021