Listing only directory in CentOS

centos

Efficiently navigating file systems is a fundamental skill for Linux administrators and users alike. We are about to explore a focused aspect of directory management in CentOS – the art of listing only directories using command-line tools


  • Usual listing with ls
$ ls -l
-rw-rw-r-- 1 user user 2809 Apr 23 2017 a.out
drwxrwxr-x 4 user user 4096 Mar 8 2018 bootstrap-4.0.0-dist.zip
-rw-rw-r-- 1 user user 1001 Aug 11 2018 social-icons.css
-rw-rw-r-- 1 user user 48312 Jan 23 2019 tmp.out
  • To list folder only, in current directory
  • $ ls -d */
    bootstrap-4.0.0-dist.zip/
  • To list folder only, in different path
    $ ls -d /your/own/path/*/
  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.