Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I'm on a Mac with Mac OS X v10.5 (Leopard). I'm using tcsh, but I could use Bash if it'd help.

share|improve this question
up vote 0 down vote accepted


ls -1 /directory/you/want/to/list > ~/Desktop/filelist.txt

which will redirect the output of ls -1 (or ls -l or whatever you want) to the file ~/Desktop/filelist.txt. Using > for redirecting outpiut works for every command, btw. Just google about "input output redirection" (or see this link).

share|improve this answer
When its output is redirected, ls automatically uses single-column output mode, so the -1 above is not necessary. – garyjohn Oct 1 '10 at 15:48

ls "path/to/folder/" > file.txt

share|improve this answer

The shell builtin "echo" on its own suffices for this:

echo * > file.txt
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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