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
- Through ls command
- 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.
Latest posts by Surendra Anne (see all)
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018
- wget download a file to a directory in Linux/Unix - June 4, 2018
- GIT: How to compare two GIT branches? - June 3, 2018
- Online training on Linux Bash shell scripting - February 8, 2018