Posted: . At: 5:21 AM. This was 2 years ago. Post ID: 16394
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to list folders starting with a dot on Linux. This is very useful.


This is how to list all directories starting with a . on Linux. This is a very useful Linux trick.

┌──(john㉿DESKTOP-PF01IEE)-[~]
└─$  ls -ld .*/
drwxr-xr-x 11 root root 4096 Feb 12 09:02 ../
drwxr-xr-x 21 john john 4096 Jun 15 15:58 ./
drwx------  3 john john 4096 Feb  8 07:38 .BurpSuite/
drwx------  7 john john 4096 Apr 19 10:44 .cache/
drwxr-xr-x 20 john john 4096 May  6 10:18 .config/
drwxr-xr-x  3 john john 4096 Apr 17 09:14 .electron-gyp/
drwx------  3 john john 4096 Apr 15 09:48 .fltk/
drwxr-xr-x  5 john john 4096 Mar 18 10:17 .hyper_plugins/
drwxr-xr-x  4 john john 4096 Feb  8 07:36 .java/
drwxr-xr-x 10 john john 4096 Jun  1 10:28 .jedit/
drwx------  4 john john 4096 Feb  4 10:10 .local/
drwxr-xr-x  3 john john 4096 Apr 19 10:24 .mozilla/
drwxr-xr-x  4 john john 4096 Apr 17 09:12 .npm/
drwxr-xr-x  2 john john 4096 Apr 19 10:52 .persepolis/
drwx------  3 john john 4096 Jan 19 07:29 .pki/
drwx------  2 john john 4096 Mar  4 13:50 .ssh/
drwxr-xr-x  2 john john 4096 Apr 28 13:15 .vim/
drwxr-xr-x  3 john john 4096 Feb  4 11:43 .wpscan/

This is another example, this shows only the visible directories.

┌──(john㉿DESKTOP-PF01IEE)-[~]
└─$ ls -ld */
drwxr-xr-x 5 john john 4096 Jun 15 13:22 Documents/
drwxr-xr-x 3 john john 4096 Apr 19 10:24 Downloads/
drwxr-xr-x 2 john john 4096 Jun 14 12:10 website/

List all directories starting with the letters a to s.

┌──(john㉿DESKTOP-PF01IEE)-[~]
└─$ ls -ld .[a-s]*/
drwx------  7 john john 4096 Apr 19 10:44 .cache/
drwxr-xr-x 20 john john 4096 May  6 10:18 .config/
drwxr-xr-x  3 john john 4096 Apr 17 09:14 .electron-gyp/
drwx------  3 john john 4096 Apr 15 09:48 .fltk/
drwxr-xr-x  5 john john 4096 Mar 18 10:17 .hyper_plugins/
drwxr-xr-x  4 john john 4096 Feb  8 07:36 .java/
drwxr-xr-x 10 john john 4096 Jun  1 10:28 .jedit/
drwx------  4 john john 4096 Feb  4 10:10 .local/
drwxr-xr-x  3 john john 4096 Apr 19 10:24 .mozilla/
drwxr-xr-x  4 john john 4096 Apr 17 09:12 .npm/
drwxr-xr-x  2 john john 4096 Apr 19 10:52 .persepolis/
drwx------  3 john john 4096 Jan 19 07:29 .pki/
drwx------  2 john john 4096 Mar  4 13:50 .ssh/

Finally, this is how to print the total size of each folder on disk and the name of each folder. This is another very useful Linux tip.

┌──(john㉿DESKTOP-PF01IEE)-[~]
└─$ du -d 0 -h `ls -ld .[a-z]*/` 2> /dev/null
395M    .cache/
153M    .config/
1.4M    .electron-gyp/
16K     .fltk/
32K     .hyper_plugins/
44K     .java/
608K    .jedit/
44K     .local/
12K     .mozilla/
138M    .npm/
4.0K    .persepolis/
76K     .pki/
16K     .ssh/
8.0K    .vim/
19M     .wpscan/

Leave a Comment

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