Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Category Archive Linux

List only directories in Linux

April 25, 2014 Comments Off on List only directories in Linux By MANOJ AGARWAL

How to List only directories in Linux

ls command is used in linux to list the files in current directory or the specified directory.  However it doesn’t list the directories only in the given directory.  We can use ls with the combination of grep command to list only directories in a given directory.  ll is the short form of long listing of directory and is used to show detailed listing of files and directories in the current/specified directory.  It can also be used with grep command to list only directories.

Type the following command:

ls -l | grep ^d

Another form of this command is:

ll | grep ^d

We can also use the following command to list only directories:

ls -d */

,

x Close

Like Us On Facebook

You cannot copy content of this page.