Terminal on Mac: How to access your Mac’s hidden command center
August 4, 2021
By Kim Komando
If you’ve used a Windows PC in the past, you might be familiar with the Command Prompt screen built into its operating system. While a bit outdated, it still exists in Windows 10.
Did you know that Mac has something similar? It’s called the Terminal, and it has some pretty nifty uses you might not be aware of. It’s also surprisingly easy to use. Tap or click here for five pro tips to get more out of your Mac.
If you are curious about how to use it, read on. Here’s how to access your Mac’s hidden command center and some useful commands for you to try in the future.
Finding command center
Even if you are familiar with Mac, you may not know where your command center is hidden. Thankfully, it’s easy enough to find:
- Open the Finder application, it should be located on your task bar.
- Open the Utilities folder.
- Double click on Terminal.
- The Terminal will then open and you are ready to enter commands.
Caffeinate
If you are running a program or importing or exporting data and want to avoid your Mac going to sleep, you can use the Terminal for that.
It’s a little-known command called caffeinate, just like giving your computer a quick cup of coffee. The command in Terminal allows you to say how long you can keep your computer from going to sleep. Do so by typing in this command:
caffeinate -u -t 3600
To exit, hit Control + C, and caffeinate will stop running.
RELATED: 10 Mac settings you should definitely be using
Clear DNS Cache
If you’ve ever heard of clearing your cache, that is what this command will help you do. It’s pretty simple to do using your Terminal:
If you have macOS 10.12 or later, use the following command:
sudo killall. -HUP mDNSResponder; sudo killall mDNSResponderHelper;sudo dscacheutil – flushcache
Once you’ve entered the command, you’ll be required to enter your admin password. After you do so, your cache will be cleared.
Force Shutdown
We’ve all run into a situation where you need to force shutdown your computer because it’s not operating the way you would like. If you can’t shut down your computer the normal way, you can do it with your Terminal. Type the following command:
shutdown -r now
Once you press enter, your computer will shut down.
Show/Hide/Hidden Files/Folders
No matter your situation, you most likely have files on your Mac that you want to keep private. Let’s go over how you can hide files and folders and see them again when needed.
How to hide files/folders:
- You’re going to use the Terminal to run a series of commands, so open it by pressing Command+Space, and then type Terminal.
- Hit Enter.
- When the Terminal loads, type the following and don’t forget to add a space at the end: chflags hidden.
- With the file or folder that you want to hide, drag and drop it into the Terminal window. This will create its path.
- Hit Enter and the file/folder will disappear.
- A path to the hidden file/folder will be created in the Terminal window.
Pro tip: You can also hide files or folders through the Terminal window by renaming the folder to start with a “.” (period). You can also hide file name extensions, although the process is different.
How to view hidden files/folders:
Now that the items you want to hide are hidden, at some point, you will want to view them again. Again, it’s a bit tricky, but here is how:
- In the Finder menu, click Go.
- At the bottom, click Go to Folder.
- A small window will pop up. The path of the hidden files/folders that are stored will be typed here.
- There is an easy way to do this. Simply start with the tilde key (~) followed by the path created in the Terminal window. If the item is on your desktop, as an example, the path will start with ~/Desktop/(then the name of the file).
How to unhide a folder:
- Open the Terminal again by pressing Command+Space.
- Type chflags nohidden (the path of the folder).
- Hit Enter and the folder will be visible again.
If you can’t remember the hidden folder’s path, you can drag and drop it into the Terminal window after typing chflags nohidden.
The Terminal can be a handy tool on Mac. Curious about Mac’s other hidden features? Here are 10 Mac settings you should definitely be using.
https://www.komando.com/news/macs-hidden-command-center/