ls command: how can I get a recursive full-path listing, one line per file?


How can I get ls to spit out a flat list of recursive one-per-line paths?

For example, I just want a flat listing of files with their full paths:


ls -a1 almost does what I need, but I do not want path fragments, I want full paths.

7/25/2013 7:32:49 PM

Accepted Answer

If you really want to use ls, then format its output using awk:

ls -R /path | awk '
NF&&f{ print s"/"$0 }'
1/6/2017 7:08:26 PM

Use find:

find .
find /home/dreftymac

If you want files only (omit directories, devices, etc):

find . -type f
find /home/dreftymac -type f

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow