Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-01-2007, 02:18 AM   #1
Registered: Jul 2007
Location: Penang , Malaysia.
Distribution: red hat linux
Posts: 133

Rep: Reputation: 15
Smile command want list all in root / by filtering file and directory?

Hi, in linux. i want to using a command to filter a directory and files. is it using ls command? example: in my / root i have many directory and files, i want to filter the files and directory, because very difficult to difference folder and files i am using this command: #ls -al .all the directory and files will show on screen, so how to filter them, like just want to view only directory or only the files.

Thank you very much.
Old 11-01-2007, 03:10 AM   #2
Registered: Oct 2007
Location: INDIA
Distribution: Rehat, Fedora, RHEL
Posts: 47

Rep: Reputation: 15
Hi hocheetiong,
just check out the options given below

1. list all files and directories (including hidden files)

#ls -al
2. list files and directories with differentiate
#ls -lp
3. list only directories
#ls -al|grep ^d

4. list only files
#ls -al|grep ^-

more details see man page of ls and use ls with grep
Old 11-01-2007, 03:16 AM   #3
Registered: Jul 2007
Location: Penang , Malaysia.
Distribution: red hat linux
Posts: 133

Original Poster
Rep: Reputation: 15
Smile It work! Thank you very much.

Hi SELVARAJU S, what commands u show to me is work!
Thank you very much SELVARAJU S you are the best!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
df command not list root directory wabaha Linux - Server 9 10-26-2007 07:49 AM
Print directory list command AlexCPU Linux - Newbie 5 11-07-2004 04:41 PM
can't see root file system with list command fr_baker Linux - General 10 06-07-2004 09:27 PM
How to list total file size of a directory phil1076 Linux - General 3 12-18-2003 04:47 PM
List the contents of a directory to a file MasterC Linux - General 19 11-26-2002 11:09 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:21 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration