facebook thumb

6 Mac Terminal Tricks and Hacks for Mac Power Users


One can't but agree that Mac OS has a stunning graphical user interface (GUI), which is also quite functional. With its help, Mac users don't have to bother running the command-line interface environment in most cases.

Knowing your way around Mac OS can help you resolve typical user issues with a standard system toolkit. However, using the hidden features of Apple's operating system is impossible without running the Terminal app. Knowing the Mac Terminal commands is essential to doing everything right.

mac terminal commands

Things You Should Know about Apple Terminal Tricks

If you have no clue about how to run the Terminal app, go to Finder → Applications → Utilities. The Terminal app icon sits in the Utilities folder, so finding it is extremely easy. Alternatively, you can launch the Terminal app directly from Launchpad.

find terminal

Since the Terminal command-line environment is a text editor, one needs to type in specific text commands and press the Enter (Return) key. To abort the command, use the Command-C key combination. The first-time command-line users may get confused with the Terminal related terms, so some of them need clarification:

  • Terminal, also known as a command-line interface, is an emulator that has no graphical user interface and works as a minimalist text editor.
  • System console is the environment consisting of the command line itself and the command output. The console is geared to process and run the entered commands.
  • Command line is the line in the console used to type in the commands.
  • Command prompt is a character or sequence of characters indicating that the console is ready to accept further commands. The Mac OS prompt ends in a $ symbol and gives the information about the current working directory and the hostname.

A typical Terminal command has three core elements: the program, the option, and the argument. The program is the action assigned to a specific command. Meanwhile, the option modifies the way a program executes, and the argument represents an object influenced by the command. Every Terminal command has a default behavior, so providing the command option is not obligatory. There can be several arguments attributed to the command, and their order is important to ensure the command is properly executed.

Essential Mac Terminal Tips and Tricks

And now, let's proceed to the Terminal commands for Mac that come in handy in different situations.

1. Don't Let Your Mac Fall Asleep

Is there a way to prevent your Mac from falling asleep? Mac power users can keep their device awake, stop it from dimming the screen or playing the screensaver with a simple Terminal trick. All it takes is to type in the below command:

$ caffeinate

It is possible to set the time periods of running the command. For this, add the -t command option, followed by the number of seconds you want to keep your Mac awake. For instance:

$ caffeinate -t 86400

When the indicated time runs out, the caffeinate command will be disabled automatically. To abort the command before it ends, use the Control-C key combination.


2. Clean Your Mac's RAM

The Terminal commands can come in handy in terms of Mac cleaning procedures. For instance, users can do a RAM purge by removing the closed apps and processes 'stuck' in Mac's memory. Instead of using special third-party applications, try doing RAM cleaning with a Terminal command:

$ purge

In case you want to automate the RAM cleaning process, the MacFly Pro app can help you deal with the issue with minimal involvement.

3. CPU Fans Stress Test

Terminal commands can be of help if you think your Mac’s processor isn't right. To have a CPU stress test, use the below command:

$ yes > /dev/null &

These days Macs run on multi-core processors, so you have to type in the command several times to match the number of available CPU cores. To quit the CPU stress test, type in killall yes

The test will help you tell if something is wrong with the fan, or if the CPU is beginning to fail.

4. Password Protection for Zip Files

 It is possible to protect your zip archive with a password, using a special Terminal command:

$ zip -e protected.zip / direction / to / file

Adding the -e command option will create a standard unprotected zip-file.

5. Set the Frequency of Updates Check

Terminal commands allow configuring how often Mac OS checks for system updates. For instance, if you want to check for updates on every three days, instead of running a default weekly check, type in the following command:

$ defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 3

The integer represents how many days a Mac will wait before checking for updates next time. In case you need to revert to the default weekly check, just type in the above command using the integer -int 7.

6. Discover Large Files

Do you need another useful Terminal command to help reclaim your Mac's disk space? To locate and remove large files stored on a computer, use the following command:

$ sudo find / -size +500000 -print

Note: using the sudo command requires authenticating as an administrator.

It is possible to set the file size using the command option. If you want to look through the files before deleting them, use this command:

$ rm “<file path>”

Mac OS is a UNIX-based operating system, meaning it comes with a command-line environment that looks like a simple text editor. In reality, the Mac Terminal app gives access to the UNIX kernel. Special commands executed via the Terminal command line allow making system-wide changes, configuring the needed settings and including particular system features. Get the most of your Mac using the Terminal app!

download MacFly Pro now