Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm on a Mac with OSX 10.5. I'm using tcsh but I could use bash if it'd help

share|improve this question

3 Answers 3

up vote 0 down vote accepted

Try

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
1  
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

 
discard

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.