Occasionally however, you might need to reveal these files and folders to fix a problem you're having with your Mac. The easiest way to reveal hidden files and folders in an active Finder window is to press the Shift, Command (⌘), and period symbol (.) keys in combination.
This action works everywhere except for the Desktop, and you can hide the affected files and folders again simply by repeating the key combo.
If you're comfortable using Terminal, entering the following command will also reveal all the hidden files on your Mac:
defaults write com.apple.finder AppleShowAllFiles YES
Once you've typed the command and pressed Enter, hold down the Option key, then right-click on the Finder icon in the Dock and click Relaunch for the changes to take effect. To switch the files back to hidden, simply change "YES" to "NO" in the Terminal command.
That's all there is to it. You can also check out our separate how-to guide on revealing the hidden library folder in macOS.