Useful Commands to Master macOS Terminal Like a Pro 2020-03-27T05:11:35+00:00

Project Description

Useful Commands to Master macOS Terminal Like a Pro

Articles • March 26, 2020

Mac OS is pretty easy to use and chances are you have never used the integrated terminal available directly in the Mac OS.

Only about 20% of people ever use the Mac OS terminal, but what is the purpose of the terminal and what are some of the most important commands you should know?

A terminal can let you do a lot more than you can do by using the Mac OS interface, and even though it has hundreds of commands – we’ll show you the most important ones that will eventually lead you to learn how to take the full advantage of the Mac OS’s terminal.

What is a Terminal command line and why should you use it?

The terminal is a command line interface which allows any user of a Mac OS to utilize a list of commands.

There are hundreds of command lines, but do you need to know any of them?

Knowing some of the most important command lines is very helpful since it can change the way you use your Mac OS computer (or a laptop).

By using a couple of specific command lines, you get to find files in your Mac OS a lot faster than if you used Spotlight search.

Managing files is a lot easier as well and you can even automate the file management with just a couple of lines. This way, you will always know where specific files are stored.

Overall, you can get a lot more power and control over your system which is one of the main reasons why users just like you learn at least the basic command lines.

However, some advanced users can even take full advantage of freely available Unix-based apps.

Let’s get to the command lines so you will know exactly what to expect but also what can be done with any of these command lines!

macOS Terminal commands you never knew about

First things first though, to start you need to know how to open command prompt on Mac.

Terminal is often ‘hidden’ in the ‘Other’ folder of your Mac. You can easily access the Other folder by clicking on the Launchpad inside your taskbar – heading to Other folder, and then clicking Terminal.

However, the easiest option would be to use a Spotlight search. To use a Spotlight search, click CMD + Space to open a Spotlight search bar. Then all you have to do is write Terminal and click Enter.

Caffeinate

How many times did you have something running on your Mac and you wanted to make sure it doesn’t go to sleep?

You could’ve gone to settings and changed all important settings to prevent it from dimming the screen, putting the hard drive to sleep, or even prevent it from turning itself off after some time of inactivity.

However, there is a terminal code that contains only one word and yet it can keep your Mac awake for as long as required.

Simply open Terminal and type in caffeinate. No matter how silly this command might seem – your Mac won’t fall asleep and you can even adjust the time by adding -t /time in seconds/ after the command line like this:

caffeinate -t 15000

Stress Test

If you are having any issues with your Mac and you’re suspecting the issue to be either a processor or any of the fans – you can simply stress test your Mac and possibly find the issue.

Also, if you feel like Mac isn’t performing as it should – all you have to do is stress test it using the following command line:

yes > /dev/null &

We also recommend launching your Mac’s Activity Monitor to check for CPU usage as it’s being stress tested.

Screensaver as a Wallpaper

Do you like your screensaver? You can temporarily put it as a wallpaper on your Mac with a simple command line:

/System/Library/Frameworks/ScreenSaver.framework/Resources/
ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine – background

This command line will temporarily put your screensaver as a wallpaper for as long as your terminal stays open.

If you want to return the wallpaper back to normal – all you have to do is terminate the terminal and your Mac will return its usual wallpaper.

Mac Can Say Anything

This one is probably more of a fun command than useful command – but it might become very useful for someone who is unable to speak.

And if that’s you, with one of the easiest command lines, you can make your Mac say anything.

All you have to do is write down the following command:

Say ‘Hi, TheSweetBits’

Instead of ‘Hi, TheSweetBits’, you can insert anything you wish.

Find Hidden Files

If you’ve ever set files to hidden and you forgot about their location – there’s nothing to worry about.

You can find hidden files with the help of a terminal and all you have to do is paste one command line:

defaults write com.apple.finder AppleShowAllFiles -bool TRUE

Once you’ve typed (or copied and pasted) this command line – you will have to restart your Finder to see all files on your Mac.

You can restart your Finder through Terminal by typing the following command line:

killall Finder

Download Video Files

Everyone uses YouTube and downloading YouTube files has never been easier. You can download them directly in the terminal!

However, in order for this to work – you will first have to install the function.

The easiest way to install the function is to download & install ‘Homebrew’ package manager. Within this package manager, simply find youtube-dl and install it.

Once you’ve installed youtube-dl function, open the terminal and write:

youtube-dl URL-of-the-video

If you’d rather not use the command line, the best YouTube downloader apps out there that help you batch download video more easily and quickly.

MacOS Update Checks

Would you like to receive the latest Mac updates as soon as they come out? Many Mac users don’t even know that this is possible with a simple command line.

All you have to do is write the following command line in the terminal:

defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

You can simply copy and paste this command line into your Mac’s terminal and you will check for updates daily, instead of weekly.

Access iCloud Drive

You can quickly copy and even move files to iCloud via Terminal on your Mac. Before going ahead with the process, you need to ensure that iCloud Drive is enabled on your Mac.

cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/

Server Response

Did you ever wonder how fast your internet connection is and whether your Mac is slowing you down or it’s really your internet that is slow?

By opening your Terminal and typing one simple command line, you get to test the server response of your Mac.

ping www.google.com

You can ping test a server response to any website. Ačll you have to do is replace Google with a site of your choice.

Conclusion

Did you even know that your Mac has a terminal? How often did you use it?

Not everyone will find any of these command lines useful – but for some users, this can change the way they use their Mac.

Also, keep in mind that these are some of the most basic command lines available and if you are more of an advanced Mac user – there is almost no limit on the things you can do within your Mac!