ls Command to See Hidden Files


If you are on a Unix-line operating system like macOS or Ubuntu and want to know the list of hidden files and folders at a given location, you can make use of the ls command with -a option.

The hidden files and folders are prefixed by a dot and are not visible if you use ls command without the -a option.

Code2care@Mac % ls -l
total 16
drwxr-xr-x    5 c2ctech  staff   160 Apr 16 10:31 AI
drwxr-xr-x@   3 c2ctech  staff    96 Apr 19 20:09 AndroidStudioProjects
drwx------@   3 c2ctech  staff    96 Apr 13 21:51 Applications
drwx------@   9 c2ctech  staff   288 May  6 23:13 Desktop
drwx------+   7 c2ctech  staff   224 Apr 22 20:16 Documents
drwx------+ 120 c2ctech  staff  3840 May  6 17:15 Downloads
drwxr-xr-x@   5 c2ctech  staff   160 Mar 24 14:09 IdeaProjects
drwx------@  93 c2ctech  staff  2976 May  6 00:46 Library
drwx------    4 c2ctech  staff   128 Mar 16 13:09 Movies
drwx------+   4 c2ctech  staff   128 Mar 16 13:06 Music
drwx------+   6 c2ctech  staff   192 May  5 22:59 Pictures
drwxr-xr-x@   3 c2ctech  staff    96 Apr 25 14:02 Postman
drwxr-xr-x+   4 c2ctech  staff   128 Mar 16 13:03 Public
drwxr-xr-x   25 c2ctech  staff   800 Apr  5 19:34 anaconda3
drwx------    5 c2ctech  staff   160 Mar 16 13:07 iCloud Drive (Archive)
-rw-r--r--    1 c2ctech  staff    29 Apr 18 19:33 vimrc

Now, let me add -a option.

 Code2care@Mac % ls -la
total 168
drwxr-x---+  53 c2ctech  staff   1696 May  7 15:37 .
drwxr-xr-x    6 root     admin    192 May  5 22:16 ..
-r--------    1 c2ctech  staff      7 Mar 16 13:03 .CFUserTextEncoding
-rw-r--r--@   1 c2ctech  staff  10244 May  5 23:22 .DS_Store
drwx------+   7 c2ctech  staff    224 May  6 23:13 .Trash
drwxr-xr-x    3 c2ctech  staff     96 Apr  5 19:36 .anaconda
drwxr-xr-x@  12 c2ctech  staff    384 Apr 19 20:13 .android
drwxr-xr-x    4 c2ctech  staff    128 Apr 11 20:51 .aws
-rw-------    1 c2ctech  staff   2912 May  4 23:25 .bash_history
-rw-r--r--@   1 c2ctech  staff    487 Apr  5 19:34 .bash_profile
drwxr-xr-x    3 c2ctech  staff     96 Apr 25 19:30 .cache
drwxr-xr-x    2 c2ctech  staff     64 Apr  5 23:27 .conda
-rw-r--r--    1 c2ctech  staff     23 Apr  5 19:36 .condarc
drwxr-xr-x    4 c2ctech  staff    128 Apr 26 10:40 .config
drwxr-xr-x    3 c2ctech  staff     96 Apr  5 19:36 .continuum
drwx------    3 c2ctech  staff     96 Apr  8 14:54 .cups
-rw-------@   1 c2ctech  staff     16 Apr 19 20:11 .emulator_console_auth_token
drwxr-xr-x@  12 c2ctech  staff    384 Apr 23 16:49 .gradle
-rw-r--r--@   1 c2ctech  staff   2175 Apr 11 12:17 .h2.server.properties
drwxr-xr-x@   2 c2ctech  staff     64 May  6 00:46 .ipython
drwxr-xr-x    3 c2ctech  staff     96 May  6 00:47 .jupyter
-rw-------    1 c2ctech  staff     20 May  6 00:08 .lesshst
drwxr-xr-x    3 c2ctech  staff     96 Apr 25 19:30 .local
drwxr-xr-x@   4 c2ctech  staff    128 Apr  6 17:29 .m2
-rw-------@   1 c2ctech  staff   1161 May  4 21:41 .mysql_history
drwxr-xr-x    4 c2ctech  staff    128 Apr  5 21:37 .pyenv
-rw-r--r--    1 c2ctech  staff    311 Apr  5 19:34 .tcshrc
-rw-------    1 c2ctech  staff   6631 Apr 18 22:09 .viminfo
-rw-r--r--    1 c2ctech  staff     29 Apr 18 19:36 .vimrc
drwxr-xr-x@   4 c2ctech  staff    128 Mar 20 17:44 .vscode
-rw-r--r--    1 c2ctech  staff    675 Apr  5 19:34 .xonshrc
-rw-r--r--    1 c2ctech  staff     86 Apr  5 13:34 .zprofile
-rw-------    1 c2ctech  staff     70 May  6 19:30 .zsh_history
drwx------   41 c2ctech  staff   1312 May  7 15:36 .zsh_sessions
-rw-r--r--    1 c2ctech  staff    554 Apr 19 20:46 .zshrc
drwxr-xr-x    5 c2ctech  staff    160 Apr 16 10:31 AI
drwxr-xr-x@   3 c2ctech  staff     96 Apr 19 20:09 AndroidStudioProjects
...
...
-rw-r--r--    1 c2ctech  staff     29 Apr 18 19:33 vimrc

As you may see above, when I ran the ls -la command, there are so many of the hidden configuration files made visible under my Mac home directory.

ls - a command to see hidden files and folders

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap