terminal app icon OS X

Terminal is a powerful tool that comes with OS X. It allows you to input commands and get output from your operating system.

Although Terminal, which is a command line interface (CLI), is powerful and often times even more powerful than a graphical user interface (GUI), it’s often under-used because either people don’t take the time to learn commands, or they are too afraid to dabble in commands because one typo and you could mess something in your system up.

Fortunately, not all commands are scary. In this piece, we’ll show you ten commands you can perform with Terminal that could be of use to you now, or in the future.

Ten fun and useful Terminal commands to use in OS X

1. Check server response

Ping is probably one of the more useful Terminal commands that an everyday Mac user might actually use. This command lets you check the response of a domain or IP address, such as “www.google.com” and see how quickly it takes for the server to respond.

To perform a Ping command, you’ll enter the following in Terminal:

ping www.google.com

Note that you can replace the URL with any website URL you want to, or use an IP address instead.

2. Disable screenshot shadows

You can easily toggle off screenshot shadows when you take a screenshot of a specific window on your Mac by using the following command:

defaults write com.apple.screencapture disable-shadow -bool TRUE

What this command does is it changes the boolean variable related to disabling drop shadows from the screen capture configuration file on your Mac from false to true so that drop shadows no longer appear.

After the following command, you’ll use this one to save your changes:

killall SystemUIServer

This will restart critical services on your Mac to save your changes. If you ever want to re-enable drop shadows in your screenshots, you can perform the above commands again, except you’ll replace “TRUE” with “FALSE” instead.

3. Show hidden files in Finder

Terminal also provides you with an easy way to show all hidden files in Finder. It’s done with the following command:

defaults write com.apple.finder AppleShowAllFiles -bool TRUE

After making this change, you’ll have to restart finder, which can be done with the following command:

killall Finder

Now, when using Finder to search for files, even files that were normally hidden to protect you from making unintentional changes that could potentially damage your system, will be displayed.

You can also easy hide hidden files once again by repeating the above commands, except replacing “TRUE” with “FALSE” instead.

4. Make your Mac say anything you want

You can also use Terminal to have your Mac say anything you want. If you want your Mac to say something out loud, you can use the “say” command, followed by whatever it is you want your Mac to say. Here’s an example:

say “Hi iDownloadBlog, Terminal says hello.”

In this example, your Mac will say exactly what is in the quotes using the default system voice.

5. Keep your Mac from falling asleep

Terminal comes with a way to keep your Mac from falling asleep, dimming the display, or showing the screensaver. Simply use the following command:


With this command having been used, your Mac will act like it just drank a Trenta-sized coffee at Starbucks. You can also set time periods up so the command is only active for a temporary period of time. To do this, add the “-t” flag, followed by a number of seconds you want the feature to be enabled for, like this:

caffeinate -t 150000

In this example, our Mac would stay awake for 150,000 seconds, and then after that time period, the command would be auto-disabled. You can also press Control + C to end the command early at any time.

6. View and clear your Terminal command history

If you ever want to see what Terminal commands you’ve entered in the past, fortunately Terminal keeps a history and you can always check back with the following command:


Once you enter it, you’ll see all of the commands you’ve used, or anyone else using your Mac may have used. It also makes it easy to copy and paste long commands you may have entered previously that you don’t feel like typing out all over again.

If you ever wanted to delete your command history from Terminal, you could just use the following command instead:

history -c

After entering this command, your history will be deleted and no one will be able to pull up your command line history to see what commands you’ve used.

7. Stress test your Mac

If you suspect your Mac’s fans aren’t working right or that your system can’t keep up with demand like it should, you can stress test your processor using Terminal with the following command:

yes > /dev/null &

If you have a multi-core Mac, you’ll need to type the command several times over to match the amount of cores you have before you press return. For example, if you have four cores, then you’ll type the command 4 times in a row before pressing return, like so:

yes > /dev/null & yes > /dev/null & yes > /dev/null & yes /dev/null &

You can launch Activity Monitor on your Mac as a bonus to watch your CPU start to crank up. You can end the stress test at any time with the following command:

killall yes

If you suspect you have a faulty fan, this is a good time to listen for grinding. Moreover, it can be used to see if your process is choking too early when it should be able to handle more of a load.

8. Enable an iOS-like power chime when connected to power

Although your Mac is usually quiet when you plug a power source into it, your iOS devices all make a chime noise when you plug them in to indicate that they’re charging. With Terminal, it’s possible to enable this feature on your Mac as well with the following command:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool TRUE; open /System/Library/CoreServices/PowerChime.app &

Now after tapping the return key, the chime will be enabled. You can also disable the chirp at any time with the following command:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool FALSE; killall PowerChime

It’s a nice little audible sound to hear when you know the power connection is connected, but it really comes down to opinion on whether or not to enable it.

9. Check for OS X updates more often

Your Mac is configured out of the box to check for updates for OS X and your Mac App Store apps on a weekly basis, but you can change that with Terminal. For example, if you want your Mac to check for updates daily instead, enter the following command:

defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

You can change the integer to any amount you want – the number represents the amount of days your Mac will wait to check for updates, so if you wanted to return back to the default weekly check, you’d use the following command:

defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 7

Now, you can notified of your important app updates and OS X updates much more frequently than before.

10. Set your Mac’s screensaver as the wallpaper

If you’re in the mood for some eye candy, you can set your current screensaver as your Mac wallpaper temporarily with Terminal by using the following fun and quirky command:

/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background

This will make your current screensaver the desktop wallpaper for as long as the command is running. If you close the Terminal app or use the Control + C shortcut, then the wallpaper will return to normal.


Terminal is a very useful tool in OS X that is under-used by Mac users. Sometimes OS X’s System Preferences app just can’t give users all the options they need access to, and Terminal is a great way for a user to really take control of their system and make changes to their own liking. Moreover, it makes a great tool for troubleshooting and performing actions, not just customizing things.

If you found this tutorial helpful, let us know in the comments below.

  • Informative post, thank you, Anthony.

    • No problem! I’m happy to see you found this informative.

      • Steve Harvey

        Informative but you left the fun part out.

  • Mark S

    To make ~/Library visible enter “chflags no hidden ~/Library/”

  • the hood

    Very informative agreed. In Australia we don’t have Starbucks or imperial measurements, but I’m assuming a ‘Trenta’ 30 in italian means 30oz, approx. 1 litre coffee drink? Yes that would keep you up alright. If so, added to the list of things to do in life. 🙂

    • Morgan Freeman

      Bro, this is a cool story. Also- I see you’re from Australia..that explains the past trolling. G’day mate.

  • QuarterSwede

    Some good gems in here I didn’t know about. I’ll have to put them to good use.

  • Scott Cain

    If you use the terminal a lot, your history can get quite long. You can search through it easily if you add to the history command with a “pipe”, the vertical bar that shares the backslash key on US keyboards, and the grep command. That will filter your history for the command you’re looking for, like this:

    history | grep killall

    will only show you commands that contained the word “killall”.

  • David Diaz Escandon

    You could always dig instead of ping. Caffeinate new best friend (Teamviewer). Nice post!

  • BlackSheep_dsg

    Monitor cpu with terminal use the top command:

    top -F -R -o cpu

    explanation of the flags:

    -F Do not calculate statistics on shared libraries, also known as frameworks.

    -R Do not traverse and report the memory object map for each process.

    -o cpu Order by CPU usage

    Or jus type top if you want everything. Ctrl C to exit

  • :D

    Any way to chime when the power disconnects? Sometimes, the cable comes out and I end up on battery power without realising.

    • I don’t think so. It’s meant to act like your iPhone.

    • If you are using the MagSafe2 charging cord, you can get an accessory called Snuglet which keeps the power cord from falling or being knocked out. Works great even when you are using the lap-top on your lap .. imagine that!

  • Hanz Worst

    I really liked the last tip, especially when used with the iTunes screensaver. And the albums actually popup and show a play button when you hoover your pointer on them. Unfortunately they don’t play when being clicked upon, but still pretty cool! 🙂

  • kimo

    how about a terminal command to turn off ALL incoming notifications OR turn off Notifications all together?

  • kokeropie

    Is there a Terminal Command to enable Text Select in Quick Look?
    “defaults write com.apple.finder QLEnableTextSelection -bool true” doesn’t work on El Capitan.

    Thanks in advance.

  • the hood

    Why was my comment deleted?

  • I’d love to write a line to ask for a low battery alert at 15% (instead of 4%) How can I achieve this? Audible would be even better!
    Thank you!

  • Jack Black

    that chime sound when connected to power is pretty neat!