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

Example

[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.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.