How to Use the Mac Terminal to Show Hidden Files and Folders

When you open the Finder on a Mac, you are only seeing a fraction of the files actually stored on your hard drive. By default, macOS hides thousands of critical system files, configuration documents, and application caches. This is a deliberate safety feature designed to prevent everyday users from accidentally deleting a file that could render their computer unbootable. However, if you are a developer, a power user, or simply trying to troubleshoot a misbehaving application, you will eventually need to view these hidden files.

Why Are Files Hidden?

In Unix-based systems (which macOS is built upon), any file or folder name that begins with a period (dot) is automatically hidden from the graphical user interface. Common examples include .DS_Store (which remembers your folder view settings), .bash_profile, and .Trash.

There are two primary ways to force macOS to display these hidden files: a quick keyboard shortcut for temporary viewing, and a Terminal command for a permanent change.

Method 1: The Quick Keyboard Shortcut

If you only need to access a hidden file once, you do not need to alter your system settings. Apple introduced a simple keyboard toggle in modern versions of macOS.

  1. Click on the Finder icon in your Dock to open a new window.
  2. Navigate to your user Home folder (or any folder where you suspect hidden files exist).
  3. Press and hold these three keys simultaneously: Command + Shift + Period (.)

The Finder window will instantly refresh. You will see dozens of new files and folders appear, all of them slightly faded or translucent. The translucency indicates that these are system-hidden files. When you are finished editing or copying what you need, simply press Command + Shift + Period (.) again to instantly hide them and declutter your view.

Method 2: The Terminal Command (Permanent)

If you are a web developer or programmer constantly working with hidden configuration files (like .git folders or .env files), toggling the keyboard shortcut every time you open a new window is tedious. You can use the Terminal to force the Finder to show hidden files permanently.

  1. Open the Terminal app (found in Applications > Utilities, or search for it using Spotlight).
  2. Copy and paste the following command exactly as written:
defaults write com.apple.finder AppleShowAllFiles TRUE
  1. Press Enter. The system will record the change, but the Finder will not update immediately. You must restart the Finder application for the change to take effect.
  2. To restart Finder, copy and paste this command and press Enter:
killall Finder

Your screen will flash briefly as the Finder quits and instantly reopens. From now on, hidden files will permanently remain visible in every window across your Mac.

If you ever want to revert to the default, safe behavior, simply open the Terminal again and run the exact same commands, but change the word TRUE to FALSE:

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.