5 Useful Terminal Tricks for Mac Users

0

Turns out you can do a lot of things faster, easier, and with more room for customization—all by peeking under the…

defaults write com.apple.finder AppleShowAllFiles -bool TRUE

Then, to let those changes take effect, restart the Finder by running:

killall Finder

You can also combine those two commands with some ampersands:

defaults write com.apple.finder AppleShowAllFiles -bool TRUE && killall Finder

(For the sake of simplicity, I’ll do that for the rest of the commands in this list that require restarting a service.)

To hide your own folder or file, you can run:

chflags hidden ~/Dekstop/MySecrets && killall Finder

… replacing ~/Dekstop/MySecrets with the path to your own secret folder or file. (The ~ denotes your home folder, also found at /home/[yourusername].) To make hidden files and folders invisible again, just run the original command with FALSE in place of TRUE.

Customize the Dock

The Dock is an important piece of the macOS interface: You store your most-used shortcuts there, use it to hop between windows, and hide minimized apps you don’t need right now. And while you’ll find some useful tweaks under macOS’ Settings > Dock menu, you can customize it even further with a few terminal commands.

For example, want to add a blank spacer to help organize your apps into groups? Run:

defaults write com.apple.Dock persistent-apps -array-add ‘{“tile-type”=”spacer-tile”;}’ && killall Dock

Or, if you’d prefer to keep the dock as minimalist as possible, you can hide all apps that aren’t currently running with:

defaults write com.apple.Dock static-only -bool TRUE && killall Dock

If you use Command+H to “hide” apps on the regular, you can even dim their icons in the dock, so you know they’re hidden:

defaults write com.apple.Dock showhidden -bool TRUE && killall Dock

Finally, if you like to show and hide the Dock automatically, you’ve probably noticed there’s a one second delay to that animation—that is, when you mouse over the bottom of your screen, it’ll take about a second before the Dock slides in. To remove this delay, run:

defaults write com.apple.Dock autohide-delay -float 0 && killall Dock

Alternatively, you can change that 0 to a higher number to increase the delay. To go back to the default auto-hide settings, run:

defaults delete com.apple.Dock autohide-delay && killall Dock

Tweak the Way Your Mac Takes Screenshots

Taking a screenshot on a Mac is super easy: Just press Command+Shift+4 to grab a window or portion of the screen. Unfortunately, you don’t have a lot of control over how these screenshots are stored—at least, from the onscreen menus. You can, however, customize things from the Terminal.

If you want to change where screenshots are stored, for example, you can run:

defaults write com.apple.screencapture location ~/Pictures && killall SystemUIServer

Replacing ~/Pictures with whatever folder you want to use. If you want to restore the default behavior, just replace that path with ~/Desktop instead.

Next, you can remove the drop shadows around screenshots with:

defaults write com.apple.screencapture disable-shadow -bool TRUE && killall SystemUIServer

You can bring them back by rerunning that command with FALSE instead of TRUE.

In addition, you can change the file type of those screenshots—which is PNG by default—to something else with:

defaults write com.apple.screencapture type JPG && killall SystemUIServer

You can replace JPG with a few file types, like PDF, if you so choose.

Finally, you can change the default name of the screenshot files with:

defaults write com.apple.screencapture name “mycapture” && killall SystemUIServer

You can replace mycapture with whatever you want the filename to be. With these few commands, you should be able to get your Mac taking screenshots exactly how you want without an extra program.

Watch Star Wars (Yes, Really)

A long time ago, in a terminal far, far away, some enterprising folks recreated the entirety of A New Hope in ASCII. It’s still available in terminals today, and on current versions of macOS, you can run:

nc towel.blinkenlights.nl 23

To watch the story play out in text form. Enjoy.


More Great WIRED Stories

Source

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *