Harness the Power of the Terminal

Harness the Power of the Terminal

Date:
Posted By:

The Terminal is a Pandora’s box of hidden treasures and power. Simply go to Your Hard Drive > Applications > Utilities > Terminal and check it out. Using Terminal requires being precise and knowing what you're doing, and any changes within Terminal are permanent, but you can do anything from hiding a folder from view with one command to speeding up an older iMac by disabling window animations. You can even batch resize images with a couple commands. It’s a gift that keeps on giving. As always, it is important to make sure you have a recent backup.

Here's some of our favorite Terminal commands:

Show or Hide Hidden Files

defaults write com.apple.finder AppleShowAllFiles TRUE

This command will make Apple display Hidden files in Finder.  If you want to swap back to having Hidden files hidden from view, simply use the command

defaults write com.apple.finder AppleShowAllFiles FALSE

The Ditto Command

ditto /old/path/ /new/path/

The ditto command will copy the entire contents of your old "path" folder to the new "path" folder.  Using Terminal to do this can run faster and smoother than duplicating file contents with Finder.

Another neat trick - if you add the -V (verbose) command, so your Terminal command will look like this:

ditto -V /old/path/ /new/path/

Terminal will actually print out a line with each content copy telling you the details of each item it copies over.  Handy if you want to know more about exactly what all is in your folder as it's being copied over.

Remove Duplicates from "Open With" Menu

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Your Mac is not always the best about keeping duplicate content to a minimum.  Using this command will clean up your "Open With..." menu and remove any duplicate programs from the list, cleaning up the menu and making it faster to select the program you want without having to navigate past duplicates.

The Caffeinate Command

caffeinate

This command unfortunately won't produce coffee for you, but it will prevent your Mac from going to sleep if you need to walk away and leave a time-consuming task running.  Once you launch this command in Terminal, it will keep your Mac from going to sleep until you press Ctrl-C to end the command.

Keep reading to learn more handy iMac tips and tricks!