16 Useful Mac OS X Terminal Commands

The Mac is full of utilities. Mac is known for its customization options, but there are some more secrets are hidden in its terminal. We can do many interesting and useful things by typing a command in terminal. Here are the 16 useful Mac OS X Terminal commands that bring you more change and comfort in your working with Mac.

Mac OS X

The terminal is an app included with OS X in your utilities folder. It provides a text based way to use our operating system.

16 Useful Mac OS X Terminal Commands:

1. Customize OS X ‘s look and feel

People love to do this. This can change the look of the dock, the scroll bars and even it can make you to see hidden files. If you don’t like the dock being in the center of the screen. You can move it by typing a simple command in terminal:

defaults write com.apple.dock pinning -string end

killall Dock

Even you wish to move the dock to the top or back the default one, just replace the word end at the start or middle instead

2. Last Login

This command lets you know who has logged in to your system and how long they have used it.

Type in terminal window

last

3. Power management

Type in terminal window. The following command will show you the overview or current power management setting.

pmset -g

This will make your computer to sleep after 15 minutes of inactivity

sudo pmset displaysleep 15

And following command will put the computer to sleep after 30 minutes of inactivity

sudo pmset sleep 30

4. Change the backup periods

Time machine backs up every hour when its connected but this can be changed with the help of the terminal. Type the following command in terminal

sudo defaults write /System/Library/Launch Daemons/com.apple.backupd-auto StartInterval –int 1800

This makes time machine back up now after every thirty minutes. And if you want to change that time you can replace 1800 with 900. So 15 minutes would be your backup time.

5.Make Your Mac Speak

This command is itself explained what it can do for you. You can trigger the native text to voice function word ‘say’ as:

say your-statement-here

This is a unique command that can bring you more in operating a Mac OS X.

6. Software update

It’s a quick way to install software updates. To use it, open the terminal window and type

softwareupdateia

and if wish to install only than type

recommended

7. Recently Used Apps

This command lets you access your recently used apps. Open your terminal and type the following command

defaults write com.apple.dock persistent-others -array-add ‘{ “tile-data” = { “list-type” = 1; }; “tile-type” = “recents-tile”; }‘; killall Dock

8. X-raying Your Folder

It gives you a quick look at any file, show you the folder size and number of files in it.

Type the following command:

defaults write com.apple.finder QLEnableXRayFolders -boolean YES; killall Dock

To disable, enter the following command:

defaults write com.apple.finder QLEnableXRayFolders -boolean FALSE; killall Dock

9. Add Widgets to Your Desktop

Apple has no problem in keeping widgets in the OS x dashboard. But if you like to use them on your dashboard type the following command:

defaults write com.apple.dashboard devmode YES

To reverse the process just changes the Yes with no command.

10. Enable 2D Dock

To enable 2D dock on your Mac type in your terminal

defaults write com.apple.dock no-glass –bool true

If you want to go back to 3D dock change the word true with false.

11. To prevent your computer from sleeping

Your computer goes to sleep when you are not using it. It’s done for power saving. But if you want you can prevent your computer from sleeping

Type in terminal window

caffeinate -t 3600

Here 3600 is meant for 3600 second you can change it as per your needs.

12. Instantly generating a calendar

Sometime you need a quick calendar so this command will generate a quick calendar for you,

Type in terminal window

cal 12 2013

Here you can change 12 with the month you want to see and 2013 with the year you want.

13. Renaming Screen Shots

When you like to take a screen shot on Mac, the default naming for it will be screenshot-date-time

You can change any name with its default name. Like I wish to use the Victoria name for screen shot than I would type a command in a terminal window using the name Victoria

defaults write com.apple.screencapture name “victoria“; killall SystemUIServer

To reverse the above command type the command

defaults write com.apple.screencapture name “”; killall SystemUIServer

14. File System Usage

This will let you find where your system is being used mostly.

Type in terminal; window

sudo fs_usage

15. Restart and Shutdown

Restart with Mac with command

sudo shutdown -r now

For shut down type the following command

sudo shutdown now

16. Disk Space

This space lets you know that how much disk space you currently have on your disk

Type in terminal window

df -h