Top 10 macOS terminal commands-That every Mac user must know

Have you ever seen anyone working on macOS? And it seems something like coding. It means you do not know about the macOS terminal commands. Well, The Terminal is an emulator that provides text-based access to the Operating systems. In the Terminal, you can do almost anything which you do manually at other times. And today, in this article, we are going to find out some of the best and most useful terminal commands that every Mac user must use once.

Visiting the Terminal app for the first time might make you feel dizzy. Therefore, it is usually overlooked by users. But it is not so difficult as it appears. Once you get the idea about how it works, then the Terminal will not look intimidating features. However, in this article, our primary focus is on some of the macOS terminal commands that every Mac user must know.

So, before going towards some of the terminal commands, lets clear our vision about the Terminal feature.

What is Terminal, and why is it used?

The Terminal is an emulator, with the help of that you can access the entire Operating system just by entering texts. Those texts are called Commands that you give to the Operating system to work on. 

Initially, Apple used the Terminal as a showcase for macOS graphics API in advertisements to offer a range of custom fonts and coloring options, including transparent backgrounds. Furthermore, you can use the Terminal to access the macOS API and other features.

How to open the Terminal and use the command line?

Before, you can use it. You will need to find it. To open the command line in the Terminal. Go to your macOS screen and open the Applications folder. Here open the Utility folder. And here, you will see an App by the name of Terminal. You can begin it by taking on it.

Or simply what I do is to search for “Terminal” in Spotlight search. And open it from there. 

So, once you open the Terminal, you will see your desktop name. And besides that, you will need to enter your command.

Some of the useful macOS Terminal Commands:

There are plenty of Commands that you can use in the Terminal. However, in this article, we will see some of the most required Commands.

keep the Mac awake:

Well, sometimes, you want to download large files. And those files can take hours to download. Isn’t it annoying to sit in front of the screen and see when the download completes? 

Here we have a command. Using this command will let your Mac awake for the time you want. To do it, you just need to open the Terminal and enter!

Caffeinate -t 3600

When you enter this command, so, your PC will remain awake for the time you specified. When I was downloading a video game, so it required 1 hour to download. So I entered the command with 3600 seconds. And went to sleep. And after one hour, my Mac also shut down automatically.

See how long you have not to reboot your system:

Are you wondering? How long you haven’t reboot your system. Well, just enter “Uptime” in the command line. And then the Terminal will tell you how long you haven’t reboot your system.

Make your Mac talk:

There is a Command, with the help of which, your Mac can speech that word or phrase. Simply just write

Say Your word.”

And the Mac will repeat that word or phrase in its default voice.

Change the default back up time in Time machine:

As a default, the Time machine backs up in every hour, when connected. However, you can change this time in the Terminal. To change the time, Enter!

sudo defaults write /System/Library/Launch Daemons/com.apple.backupd-auto StartInterval -int 7200

Now, the time machine will backup every two hours. Besides, you will also need to enter the password before changing the settings as you are applying a Sudo command. So, check your command thoroughly before execution. And if you want to set your own time, just change the figure that I have put 7200 to your number of seconds.

Show hidden files in Finder:

If you do not know how to show hidden files in macOS, so, entering this command is the best way to reveal the hidden files. Enter the command

defaults write com.apple.finder AppleShowAllFiles TRUE

So, now all the hidden files are visible in your Finder. To make them invisible again, just change the True to False. And all the data will hide again.

Change the screenshot file format:

The default format in which the screenshot is saved in your PC is PNG. However, you can change this format into your required format just enter the command

defaults write com.apple.screencapture typefile-extension

Entering this command and replacing the file extensions with like Jpeg, PDF, SVG, etc. And then, the screenshot pictures will save in those formats.

Make new screenshot default name:

When we take screenshots. So, usually, the default name is the date and time of that screenshot. Fortunately, you can change that name, and replace that with any name you want. To do so, Enter the command

defaults write com.apple.screencapture name "techvatan"

then type

killall SystemUIServer   

Now, all the screenshots I take will name Tachvatan with numbers.

Add the gap between your apps in the dock:

This one is one of my favorites. Because with the help of this command, I can classify my apps and can make separate groups of related apps. With this command, you can create space between the apps and organize them randomly. To execute this command enter

defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'

then type

killall Dock

View and delete your entire download history:

Whenever you download something from the internet. So, you wipe out that download history. Do you delete that download history? What if I say No. There are still ways to recover or find that history. One of the effective ways to delete the download history is to view and remove those from the Terminal. To do it enter the command

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'

and then enter the following command to delete those

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'

Now, to confirm the history is deleted permanently. Enter the first command again. And the list must be empty.

Copy files between the folders:

Last but not least, you can also duplicate files between the different folders. You may be using drag and drop function; however, if you want to do it from the Terminal. We have brought the technique to you. To do this, enter the command!

Ditto [original folder] [new folder]

Next up in macOS:

Bottom Line:

In this article, we brought the top 10 macOS terminal commands, that you can use it in the Terminal. Furthermore, we also clarified the Terminal app for those that did not learn about it before. We hope this report gives you more knowledge and info about the macOS. DO follow us for more, and do not forget to tell us your favorite terminal command in the comment section.