[help] Terminal Commands

Ok what I want to do is list folder contents in the terminal so that I can cope the file names into a text doc, how do I do this?

thanks

contra im looking in your direction ;)

#124744

ls

or ls -l to list directory with properties.

#124755

You can also do

ls > filelist.txt OR

ls -l > filelist.txt

to automatically output the list to a text file.

#124756

Andrew179 gave the right advice. Be warned though, using ">" will overwrite any text that is already in the file, so use ">>" if you want to append to an existing file.

#124769

k im obviously a teminal idiot, so i do ls-l, then i see the folder that i want to list the files, then what>?

#124775

ls lists the directory that you're currently in, so if you are in the directory with the files you want to list, then just do:

ls -l > filelist.txt

or if you are not in the directory, type

cd *directorynamehere*

ls -l > filelist.txt

#124782

ahhhhhh, i gotcha Thanks sooooo much, you just made my life so much easier

#124783

ok, im still having some issues with this. Let me see if I can explain this a little better. On my desktop i have a folder, in that folder is another folder, and inside that folder is three other folders.

When I do a cd, I can go cd desktop, cd work (the folder on the dtop) cd kjell (folder inside that folder) and thats as far as i can go.

any ideas

#125117

Rofl...learning UNIX for the first time

good luck! I looove it!

#125120

Originally posted by Photo678@Mar 6 2004, 02:26 PM

ok, im still having some issues with this.  Let me see if I can explain this a little better.  On my desktop i have a folder, in that folder is another folder, and inside that folder is three other folders.

When I do a cd, I can go cd desktop, cd work (the folder on the dtop) cd kjell (folder inside that folder) and thats as far as i can go. 

any ideas

What is the output of "ls -a" in that last folder, can you see the folders?

That's really odd.

#125140

Yeah, i can see the folders in the list, just can change the directory to them, or do is there a way to list the contents of that each folder.

#125148

There are a bunch of parameters for ls but for just simple usage try ls -l , ls -a, and ls -m or just ls. It all depends on what type of information is shown, like

ls (will show non hidden files in alphabetical order)

ls -l (will show permissions)

ls -a (will show hidden files)

ls -m (will display names in a single line, with commas separating names)

If you just wanna quickly view the text file in the terminal just cat it

cat textfile.txt

#125153