Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Right now I'm calling the the following command ls -R and am receiving an output like this:

file.txt script.php


Is it possible to get the output to look like this:

./file.txt ./script.php ./dir/file.txt ./dir/

I've looked through the parameters of ls and can't seem to find anything that will do what I want.

share|improve this question
Not a good idea once your filenames start having space characters in them. – Daniel Beck May 29 '11 at 12:42
up vote 3 down vote accepted


find . -type f -printf '%p '

It will output one reeeally long line of the file names (incl. path) separated by space. There will be one bonus space at the end of it, too.

(You can trade that in for a newline by piping to sed 's/ $/\n/', which might be a good idea anyway.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .