Most Useful Terminal Commands Every Mac User Should Know


Your Mac’s terminal can do some surprisingly useful things, like controlling the speed of your Internet, changing the types of applications you see on the port, and helping you shut down your Mac at set times. There are also some features that are only available with the Terminal, so if you haven’t tried them yet, it’s a good time to change them.

Launch an internet speed test

If you have MacOS Monterey, you can control the internet speed directly from the terminal. To perform upload and download speed tests at the same time, type the following command, and then press enter:

networkQuality

To run upload and download speed tests at the same time, use this command:

networkQuality -s

Hide inactive apps from the dock

The dock on your Mac is sometimes very cramped. One way to solve this is to hide all inactive applications from the port. You can do this with a simple terminal command.

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

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

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

Alternatively, you can reset your Mac’s port to factory defaults using the following command.

defaults delete com.apple.dock; killall Dock

Restart Finder

The Finder is like the invincible boss of the game that everyone always talks about. You can close or force all applications on the Mac except Finder. However, this little cheat will help you restart the Finder, which is useful when the application is stuck.

killall Finder

You can also add an option that allows you to quit the application (which means restarting in the case of the Finder) from the menu bar. Use this command to complete the task:

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

This will automatically restart the Finder, and when you click the Finder menu at the top of the screen, you’ll see a new option called Exit Finder.

To hide this option, use this command:

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

Keep the Mac’s display awake

A simple terminal command allows you to keep your Mac’s display awake. To permanently stop the display sleep mode on your Mac, open Terminal and use this command:

caffeinate

When you’re ready to sleep on your Mac screen as usual, press Control + C on your keyboard.

You can also use this command to leave the display up for an hour:

caffeinate -u -t 3600

You can change the duration at the end of this order. The amount should be in seconds, so if you want to leave the display awake for 10 minutes, you can change the number to 600.

Schedule shutdown

You can use this command to shut down your Mac at a set time:

sudo shutdown -h +30

Here +30 means you plan to shut down for 30 minutes. You can change the number to whatever you want. Similarly, you can restart with this command:

sudo shutdown -r +30

Create ASCII art banners

For those who feel creative but don’t have the skills to be an artist, Terminal can create beautiful ASCII art on a Mac.

banner -w 50 Techfizia

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

Change the default screenshot format

MacOS has a fairly robust screen capture tool that stores photos on the screen in the standard PNG format. If you want to convert it to JPG, insert it into the Terminal:

defaults write com.apple.screencapture type JPG

You can use the same command to convert JPG to PDF or TIFF and use screenshots.

Download files without opening your browser

If you have copied the direct download link to the clipboard or if you already remember it, you can use Terminal to download the file without using a browser. Here is the command you need:

curl -O URL

Note that -O is an uppercase letter, if not zero, and you will need to change the download link URL for this command to work.

Copy and paste files

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

ditto -V [old folder] [new folder]

Here, the old folder should be replaced with the root folder path and the new folder should point to the folder you want to paste those files into.

View history of Terminal commands

To see all the terminal commands you’ve used so far, try:

history

Write a Comment