how can i list file in ther directory

How can I list file in directory and subdirectory

teeraAsked:
Who is Participating?
 
Mohan ShivaiahCommented:
To list file in directory and subdirectory and also you can see the size of the file using
the command
du -k /path_to_the_folder.

mohan shivaiah
0
 
ppfoongCommented:

ls
ls -l
ls -al

normally, an alias called "dir" is also predefined. "dir" is the DOS command for the same purpose.

0
 
ppfoongCommented:

If you want to list BOTH the directory and all subdirectories under it, use:

find



0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
sunnycoderCommented:
Hi teera,

ls -r

-r is recursive option and would list all entries in the subdirectories too.

-A option would suppress the implied . and .. entries in each directory ...

-1 option can be used to display one entry per line

ls -Ar /path/to/top/dir

Another option is to use find

find /path/to/top/dir -type f

Note that this will display only the files and not the names of the sub-directories

Cheers!
sunnycoder
0
 
arvindCommented:
cd dir

ls -ar *

0
 
akumanovaCommented:
if the ls command doesn't work, you can use the echo coomand within the shell to list the files in a directory.  For example, echo *.
0
 
marxyCommented:
To list recurcivelly use

ls -lR
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.