Show Hidden Files in Mac Terminal


This article is a 1 minute read

To see hidden files in the Mac Terminal make use of the ls (list directory) command with -a option,

Syntax:

ls -a

Example:

% ls -la
-r--------    1 code2care  staff      7 Mar 19 21:28 .CFUserTextEncoding
-rw-r--r--@   1 code2care  staff  18436 Sep 11 09:53 .DS_Store
drwx------+   2 code2care  staff     64 Sep 10 08:50 .Trash
drwxr-xr-x   15 code2care  staff    480 Aug 21 19:18 .android
drwxr-xr-x    4 code2care  staff    128 May 23 00:36 .aws
-rw-------@   1 code2care  staff   4412 Sep  9 00:09 .bash_history
drwxr-xr-x    3 code2care  staff     96 May 28 12:29 .bitnami
drwxr-xr-x    4 code2care  staff    128 Jun 16 18:26 .cache
drwxr-xr-x    3 code2care  staff     96 Mar 18 23:10 .config
drwx------   10 code2care  staff    320 Sep  9 14:40 .docker
drwxr-xr-x    8 code2care  staff    256 Jun 16 18:26 .eclipse
-rw-------    1 code2care  staff     16 Mar 18 18:28 .emulator_console_auth_token
-rw-r--r--    1 code2care  staff    238 Sep  8 10:53 .gitconfig
drwxr-xr-x    9 code2care  staff    288 Apr 16 00:00 .gradle
drwx------@   5 code2care  staff    160 Sep 11 09:47 Desktop
drwx------+  12 code2care  staff    384 Sep  7 13:29 Documents
drwx------+  62 code2care  staff   1984 Sep  9 22:24 Downloads
drwxr-xr-x    8 code2care  staff    256 Sep  7 16:42 IdeaProjects
drwx------@  98 code2care  staff   3136 Aug 22 10:28 Library
drwx------    4 code2care  staff    128 Dec 25  2021 Movies
drwx------+   4 code2care  staff    128 Dec 25  2021 Music
drwxr-xr-x@  27 code2care  staff    864 Sep 10 08:51 My Files
drwx------+   6 code2care  staff    192 Aug 23 17:19 Pictures

Examples of hidden files

As you may see in the above example, all the files that are hidden start with a dot prefix, and they are denoted by a dash (-) in the file permission at the start,

-rw-r--r--@   1 code2care  staff  18436 Sep 11 09:53 .DS_Store
-rw-------@   1 code2care  staff   4412 Sep  9 00:09 .bash_history
-rw-r--r--    1 code2care  staff    238 Sep  8 10:53 .gitconfig

Examples of hidden directories

All the entries denoted by a letter d as the first letter in the permission and the name starts with a dot are hidden directories,

drwxr-xr-x    3 code2care  staff     96 May 28 12:29 .bitnami
drwxr-xr-x    4 code2care  staff    128 Jun 16 18:26 .cache
drwxr-xr-x    3 code2care  staff     96 Mar 18 23:10 .config
drwx------   10 code2care  staff    320 Sep  9 14:40 .docker
Show Hidden Files Mac Terminal


Have Questions? Post them here!
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.