What is Terminal and How Does it Work?
The macOS Terminal is a Command-Line Interface (CLI) that responds to commands input by the user to perform a variety of functions. The Terminal is basically the raw interface for interacting with your Mac. Owing to this attribute, it can let you tinker with your Mac to a greater extent than you can do through the normal interface. It is command-specific and responds only to specific words that are designated command lines. Although it may seem a bit complicated at first, it is relatively easy to use the Terminal and does not require you to be some kind of tech-wiz. That’s why we’re here to start you off with these 15 essential commands for the Terminal, so you can get a little taste of what the Terminal can truly offer.
How to Open the Terminal?
To open the Terminal, there are several ways. We will be using the Spotlight method due its simplicity.
Essential Terminal Commands and Their Functions
Here is a table to start you off with the Terminal. Some of the commands have been explained in detail below.
1. Keep your Mac awake
Everybody finds themselves in situations where they have to leave their work on short notice. Often, there is some important process running that you have to keep a watch over e.g. a download or an installation, as the system may fall asleep over a long period of inactivity. Instead of looking around for third-party apps to keep your Mac awake, make use of the Terminal. Simply enter this command to keep your Mac awake and prevent it from falling asleep. To exit this state, press Control + C or simply exit the Terminal. If you want to “caffeinate” your Mac for a set amount of time, try this command:
2. Download files from the Internet
Nearly everyone would prefer downloading files through Safari on macOS. However, you don’t necessarily need to open Safari (or any other browser) to download something if you a direct download link (DDL) for it. The following command is handy for when your browser is acting up, but keep in mind that it does not work with just any random link. Read up on how cURL Downloads work if you want to learn more about which links qualify. The downloaded file will be found in the root folder of your Mac user account, so first, change the download location to your Downloads folder with this command: After that, simply enter this command on the Terminal along with the link to begin downloading the file:
3. Automatically restart your Mac when it crashes/freezes
Usually, system crashes/freezes are unpredictable. One thing that you should first do, in case this happens, is to have patience and hope that it will start working again. If it doesn’t, hold down the power button to restart your Mac. Another precaution that we can take is to enter this command on the Terminal. This command allows the Terminal to restart your Mac automatically if it senses a crash/freeze coming or if one occurs.
4. View hidden files and folders
macOS, by default, hides files and folders that are crucial to the system so that you don’t delete them by mistake. But, where external drives are concerned, this feature becomes a hinderance. Then follow this up with the command below to restart Finder: There you have it! Now you can view all the hidden files on folders on your Mac. To hide them all again, simply replace “TRUE” in the above command with “FALSE”. Note: Always do a Google search to check whether the hidden file or folder you want to delete is not vital to the system.
5. Clear out DNS cache
It is recommended to clear out your DNS cache every once in a while. Doing so can alleviate several browsing ailments such as problems in loading websites, error 404s, etc. Clear out your DNS cache with the following command: Entering the command will generate a password prompt. Enter your Mac user account password and hit Enter.
6. Terminal User Manual
Everything nowadays comes with its own instruction manual and guidelines on how to use the object carefully and effectively. The Terminal is no different. To get more details about a specific command, use this command:
7. Create Symbolic Links
Symbolic Links are similar to shortcuts on Windows. In Windows, you can right-click on any file/folder and select “Create shortcut” to make an easy-access point for that file/folder. In macOS, you can do this through the Terminal with the help of the following command: Replace [/path to original] with the directory of the file/folder of which the shortcut is supposed to be made, and, replace [path to link] with the directory of where the shortcut is supposed to be made. See the screenshot above for example.
8. Activity Monitor in Terminal
The Activity Monitor on macOS is a functionally the same as the Task Manager on Windows. It displays the processes and applications running in the background. The Terminal has its own version of the Activity Monitor. Upon entering the command, a list of all the processes and applications running will be displayed along with their rate of memory consumption, uptime, PID (Program ID), etc. To end a process, enter the following command. If there are multiple processes being run by the same name or same application, enter this command:
9. Command History
At any time to check your command history, input the command below. At any time to search for a specific command, extend the following command. If you want to clear your command history, enter the following command:
10. Download YouTube videos
This is not technically a command a system command. To do this, you need to first have Homebrew installed on your macOS. You can do this by following this guide. It may seem like a hassle but it is undoubtedly much more simpler that installing a third-party app or trying to download it from some ad-ridden website. Keep in mind that you do need Homebrew installed on your Mac in order to pull this off. After installing Homebrew, enter this command on the Terminal: It will begin downloading a package. Once done, you can now download your favorite videos from YouTube with the help of a simple command: The complete guide and full set of features for this tool are available through here. We would like to warn users, though, that this command proved to be quite buggy at our end. It seems to work fine for some users, and causes issues for others.
11. Pinging a website
If you find yourself unable to access a website, you can check whether it is properly receiving data from your end and transmitting it back to you. Simply enter the following command: This command can also be performed on your own router and IP address.
12. Check your Internet speed
Why bother yourself by running a web browser to check your Internet through sites such as Speedtest.net, when you can do it on the Terminal with 1 simple command! Yes, you read that right. Just pop up the Terminal, and enter this command: It will begin displaying a bunch of tests it’s carrying out and, after a short while, return with the test results that give you a clear and comprehensive status of your Internet speed.
13. Disable Gatekeeper
Gatekeeper, on Macs, is a behind-the-stage security feature that ensures that only verified apps run on your Mac. It checks if the app is downloaded from the App Store, comes from a verified developer and if it is free from any kind of computer viruses. However, if you feel that Gatekeeper is preventing you from installing and running an app, that you know is safe to use, simply disable it with this command: To enable the Gatekeeper back again, simply enter this: Note: Only use this command if you’re sure that the app in question is, indeed, safe to install and use. We are responsible for any harm that may come to your Mac.






















