Home How To Top 5 Terminal Tricks in macOS You Should Try

Top 5 Terminal Tricks in macOS You Should Try

by Unallocated Author

There are a lot of tweaks you can do to the settings from the macOS’ System Preferences. But if you really want to dig deep and customize your system to your own choice, the Terminal has lot of hidden little tricks. Here are five of my favorites in macOS.

Prevent Your Mac from Sleeping

If your Mac goes to sleep at inopportune times, you have a couple of choices. You can use a tiny little app to keep it awake, open up the Energy Saver preferences, or–more conveniently–employ the Caffeinate command. While the former two methods are just as effective, they involve a few more steps than just typing a simple Terminal command and being done with it.

Seriously, it’s that quick. Just open a Terminal and run:

caffeinate

…and your Mac will stay awake until you cancel it.

Caffeinate has a lot of options, though, like setting your Mac to stay awake for a certain amount of time. Check out our full guide to the Caffeinate command for more.

Add Blank Spaces to the Dock

Your Dock is full of app icons and has become an unruly mess. How, then, do you organize it? By adding blank spaces, of course. These little separators help you group your apps however you want, which gives your eyes a break from a long continuous line of apps.

To add a blank space, use the command:

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

Then type:

killall Dock

Repeat this procedure for as many blank spaces as you need. To remove one, just drag it off the Dock like you would any normal app icon.

Easily Copy Any Folder Path Into the Terminal

Say you need to access a file or execute a command from a specific Finder location, but you don’t want to type out the entire path. Trust us, that can be pretty tedious, especially if you get one small thing wrong.

In reality, it’s a snap to open any Finder location in Terminal. Just head to the folder in Finder, drag the folder or file onto the Terminal window, and just like magic that location will be displayed on the command line.

 

Easily Hide Folders in the Finder

This next trick will actually let you use your newfound Finder-to-Terminal dragging skills. Because there’s no real way to hide Finder folders from the macOS user interface, you have to turn to the command line instead.

When you use this command:

chflags hidden /path/to/folder

It’s possible to instantly hide any Finder location.

The folder isn’t moved or deleted, it’s still there, you just can’t see it. So, if you want to tidy things up or hide stuff from prying eyes, use this command.

Expand the Print and Save Dialogs

Tired of always expanding the Print and Save dialogs on your Mac? Why not just make them permanently expand with two quick little Terminal commands?

496x548ximg_57c8650fa908e-png-pagespeed-gpjpjwpjjsrjrprwricpmd-ic-u-zml7q04i-1

Simply run the following command to permanently expand Print and Save dialogs, respectively:

defaults write -g PMPrintingExpandedStateForPrint -bool TRUE
defaults write -g NSNavPanelExpandedStateForSaveMode -boolean TRUE

Once these commands are executed, you need to restart your computer to put them into effect and then you will have access to all the extra options on both dialogs without having to open the details.

You may also like