How to View or see only directories in Linux

How to view/list only directories in Linux?

This is a small post for Linux new babies. Viewing folders can be achieved by two ways in linux/unix

  1. Through ls command
  2. Through find command

With ls we have to use grep to get the directory listings..

Ls –l | grep ^d


[root@test surendra_a]# ls -l | grep ^d

d——— 2 surendra_a surendra_a 4096 Sep 8 09:54 HTWFAIP

drwxrwxr-x 2 surendra_a root 4096 Nov 27 12:30 LinuxCBT – RHEL5

drwxrwxr-x 2 surendra_a root 4096 Oct 12 16:40 Software

Through find command

find . -type d

The above command will show you all the file types which are directories in present working directory.

Show your love by sharing this..!
Share on VKShare on StumbleUponShare on YummlyPrint this pageFlattr the authorShare on TumblrEmail this to someoneBuffer this pageShare on Google+Share on LinkedInShare on FacebookTweet about this on TwitterPin on PinterestShare on RedditDigg this
The following two tabs change content below.
My name is Surendra Kumar Anne. I hail from Vijayawada which is capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. I work with ICE systems, Sydney as Sr. Consultant. You can contact me at surendra (@) linuxnix dot com.
  • Kasim123

    There is one more command to list only directories instead of files.

    lnx_host-105 ~ ->% ls -ld  */


    Check Dir with soze

    du -h –max-depth=1 | sort -n -r

  • Mpasha06

    Check Dir with soze

    du -h –max-depth=1 | sort -n -r

  • Alex Borrell

    Thanks on how to do things the easy way!

  • Surendra

    wlcm man..!