3 command line tips OS X users need

Tackling Terminal

Apple, OS X, Mac, Mac OS X, Terminal, fsck
Credit: AppleHolic

The Unix roots of Apple’s OS X means the operating system offers a range of performance and troubleshooting features every Mac user should get to know.

Many of these tools require use of the Terminal app. This is a command line app that offers deep access to your operating system. You don’t have to be an expert to use these Terminal tips, but it is essential you only use commands in the forms listed here to avoid accidentally damaging your machine.

Introducing fsck

I can’t praise fsck highly enough. These four letters have saved many a Mac, helping me bring the computer back to life when all else failed. On several occasions I have been able to use this command to launch an ailing Mac for just long enough to back drive contents up before the drive or other hardware problems finally prevail. It’s incredibly useful.

Technically, the fsck “file system consistency check” tool helps you check and repair file systems on OS X, Linux and other Unix-like operating systems. Here’s how to use it to help fix an unhappy Mac:

Boot the Mac into Single User mode, depressing the Command and S keys while the system boots up. You’ll hear the startup chime and will see white text on a black background appear.

When startup completes, you’ll see a command prompt prefaced by a # sign at the bottom of the screen.

Type the following:

fsck -fy

The process begins and you should see a range of text alerts appear within the interface.

Once the process ends the dialog will say one of two things: “File system was modified”, or “The volume (name) appears to be OK”. If you see the first statement you must run the fsck –fy operation again. If the dialog ends with the same message you should run it once more. It is possible you may need to run fsck –fy several times – what’s important is to remember that it is only when the dialog tells you “The volume (name) appears to be OK” that the system will have been properly repaired. That’s the way this thing works.

Once you’ve finished the process, type “reboot” to leave Single User Mode and the Mac should startup as normal. When your Mac does start up it makes sense to run Verify using Disk Utility to make sure your computer is OK.


Another useful(ish) command for Terminal, top provides you with a quick overview of how your apps are using system resources. This is a good way to figure out if any of your apps are consuming too much CPU power, for example. To use it just launch Terminal and type top, though I think OS X Daily has the right idea when it suggests running top –F –R –o cpu for best results. Just quit Terminal when you’re done.

Better image capture

By default, OS X saves screengrabs as PNG files, but you can change this using Terminal.

To save grabs as JPEGS, type the following:

defaults write com.apple.screencapture type JPG

To save grabs as PDFs type

defaults write com.apple.screencapture type PDF

And to return to PNG files, type

defaults write com.apple.screencapture type PNG

I tend to set my Macs up to save files in JPEG format, as I find that the most useful for me. (There are other image types you can deploy, as detailed here).

Google+? If you use social media and happen to be a Google+ user, why not join AppleHolic's Kool Aid Corner community and join the conversation as we pursue the spirit of the New Model Apple?

Got a story?Drop me a line via Twitter or in comments below and let me know. I'd like it if you chose to follow me on Twitter so I can let you know when fresh items are published here first on Computerworld.

The march toward exascale computers
View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies