The Most Useful Terminal Commands Every Mac User Should Know

The Terminal on your Mac can do some amazingly useful things, like checking your internet speed, changing the types of apps you see in the dock, and helping you shut down your Mac at the scheduled time. There are also some features that can only be accessed using the terminal, so if you haven’t bothered to use it yet, now is the time to change that.

Run an internet speed test

If you have macOS Monterey, you can check your internet speed right from the terminal . To run upload and download speed tests at the same time, type the following command, and then press ENTER:

networkQuality

If you want to run download and upload speed tests one by one, use this command:

networkQuality -s

Hide inactive apps from the dock

The dock on your Mac can sometimes feel a little too cramped. One way to fix this is to hide all inactive apps from the Dock . You can do this with a simple terminal command.

defaults write com.apple.dock static-only -bool true; killall Dock

To reset the dock to its original state, use this command:

defaults write com.apple.dock static-only -bool false; killall Dock

Moreover, you can also reset your Mac’s dock to factory defaults if you use the following command.

defaults delete com.apple.dock; killall Dock

Restart Finder

Finder is like the invincible boss from that game everyone is talking about . You can close or force close all applications on Mac except Finder. However, this little cheat code will help you restart Finder , which is useful when the app freezes.

killall Finder

You can also add an option to let you exit the application (which means restart in the case of Finder) from the menu bar. Use this command to complete the job:

defaults write com.apple.Finder QuitMenuItem 1; killall Finder

This will automatically restart the Finder, and if you click the Finder menu at the top of the screen, you will see a new ” Exit Finder ” option.

To hide this option, use this command:

defaults write com.apple.Finder QuitMenuItem 0; killall Finder

Keep your Mac display awake

A simple Terminal command allows you to keep your Mac’s display active. To prevent your Mac’s display from going to sleep indefinitely, open Terminal and use this command:

caffeinate

When you’re ready to let your Mac’s screen go to sleep as it usually does, press Control + C on your keyboard.

You can also keep the display on for an hour with this command:

caffeinate -u -t 3600

Feel free to change the duration at the end of this command. The value must be in seconds, so if you want the display to stay active for 10 minutes, you can change the number to 600.

Schedule outage

You can use this command to shut down your Mac at the scheduled time:

sudo shutdown -h +30

Here +30 means you plan to shutdown in 30 minutes. You can change the number to whatever you want. Similarly, you can schedule a reboot with this command:

sudo shutdown -r +30

Creating Artistic ASCII Banners

For those who are feeling creative but don’t have the skills to become an artist, Terminal on Mac can create beautiful ASCII graphics.

banner -w 50 Lifehacker

In this command, the number after -w is the width of the ASCII art measured in pixels, and Lifehacker is the text. You can replace these values ​​to create your own version of this artwork.

Change default screenshot format

macOS has a fairly robust screenshot tool that saves photos of your screen in PNG format by default. If you want to change this to JPG, paste this into the Terminal:

defaults write com.apple.screencapture type JPG

You can replace JPG with PDF or TIFF in the same command to use these formats for your screenshots.

Download files without opening a browser

If you have a direct download link copied to your clipboard, or if you remember it, you can use the Terminal to download the file without using a browser at all. This is the command you need for this:

curl -O URL

Note that -O is a capital o, not zero, and that you will have to replace the URL with a download link for this command to work.

Copy and paste files

You can use the ditto command to copy and paste files from one folder to another directly from the terminal.

ditto -V [old folder] [new folder]

Here, [old folder] should be replaced with the original folder path, and [new folder] should point to the folder where you want to paste these files.

Viewing the history of Terminal commands

If you want to check all the terminal commands you have used so far, try this:

history

More…

Leave a Reply