How can I make the ls command show a file's full path instead of just its filename? With all its options, there must be a way, right?


Here is one option for doing this.

ls -d $PWD/*
| improve this answer | |
  • 1
    Or even better ls -d $(pwd -P)/filename which will resolve all symbolic links if required. – Marki Nov 23 '14 at 21:26

This is another way for individual files:

readlink -e filename
| improve this answer | |
  • Combining with find: find . -exec readlink -e '{}' \; – MikeyB Mar 2 '11 at 17:49
  • Use greadlink from homebrew's "coreutils" package if you are on OSX, because the readlink that comes with your laptop seems to have a different API. – John Hamelink Feb 8 '19 at 15:42

I usually use the find command:

find /dir -type f -name "*"
| improve this answer | |
ls -d "`pwd`"/*

that's what worked for me.
Use *.mp3 if you want to list just mp3 files, for example. I did this to make a playlist.
keep the "" if there's spaces in the outputs (the path to the files)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.