LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   using grep command (https://www.linuxquestions.org/questions/linux-newbie-8/using-grep-command-655081/)

hiteshthappa 07-11-2008 06:46 AM

using grep command
 
HI
can anyone plz tell me how do i displayout the list of directories from my current working directory using grep command.
:o

pixellany 07-11-2008 07:21 AM

Welcome to LQ---Looking at both of your posts, it looks like you are asking homework questions. You need to be aware of the policies on this.

One way to do this is use the "ls -l" command and then use grep to find the leading "d" on all the directories.

Look at:
man ls
man grep

mrrangerman 07-11-2008 07:27 AM

If your just looking to list the directories use ls to see all directories even hidden ls -a.
To learn more about grep man grep

Use grep with pipe

ls | grep argument

colucix 07-11-2008 07:28 AM

You can also try
Code:

ls -d */
this will list only the directories, without listing the content of the directories themselves.

aldomenico 07-11-2008 08:34 AM

To list all directories including the hidden ones:

ls -al | grep "^d"


All times are GMT -5. The time now is 04:04 AM.