Looking at the changes to Snow Leopard's top command
Macworld - I often use top in Terminal as a quick-and-dirty version of Activity Monitor. top can report on CPU and memory usage, and much more. Because I have Terminal running all the time, top is only a few keystrokes away when I'm curious about what my system may be up to.
In OS X 10.5, I used top -u 10 regularly; the -u flag sorts by CPU usage, and the 10 restricts the output to 10 processes. This gave me a quick snapshot of the top CPU usage hogs on my Mac. I used this command so often in 10.5 that I had set it as an alias; I just needed to type t10 to run it.
In 10.6, though, this command fails, and fails miserably, because top has been updated to a much newer version (the 10.5 version of top is dated September 25, 2008; the 10.6 version is dated June 25, 2009.)
In the new version of top, many of the runtime options have changed, including -u (which is now used to specify a username). You can find out more about the new version by typing man top in Terminal.
In case you'd just like the easy way to recreate my simple CPU usage tracker from 10.5, the 10.6 version of the command is:
top -o CPU -n 10
Now that I have the above command assigned to my t10 alias, everything works as it did in 10.5.
In addition to the changed runtime options, Mac OS X Hints contributor felix-fi points out a useful new feature in the 10.6 version of top: it's now dynamic.
In 10.5, if you started top and resized the Terminal window, nothing would happen--top would just continue to display the same columns as it did when you launched it.
In 10.6, though, top will show additional data as you expand the Terminal window--make it wide enough, and eventually you'll see 26 separate columns of data.
On my 15-inch MacBook Pro, seeing all the columns requires reducing the font size to the edge of readability, and making the window the full width of the screen.
You'll find definitions for each column by browsing man top; COW, for instance, is the column that contains "copy on write faults," not some obscure reference to Clarus the Dogcow.
If you want to run top and have it only show certain columns, you can do that with the -stats option. For instance, this command will show processes in descending order of CPU usage, displaying only the process ID, command name, and CPU usage:
top -o CPU -stats PID,COMMAND,CPU
After adjusting to the changes, I've found the 10.6 version of top to be a great improvement over its predecessor.



- Excel 2010 Cheat Sheet
- Register for this Computerworld Insider Cheat Sheet and gain access to hundreds of premium content articles, guides, product reviews and more.
- VMware View Optimization Guide for Windows 7
- This document provides guidelines for configuring a standard Windows 7 image to be used within a VMware View™ environment, providing administrators with the...
- Watson - A System Designed for Answers. The future of workload optimized systems design
- Watson is a workload optimized system designed for complex analytics, made possible by integrating massively parallel POWER7 processors and DeepQA technology. Read the...
- Overcome Top 7 Admin Challenges of Active Directory
- As Active Directory's role in the enterprise has drastically increased, so has the need to secure the data. Gain insight on creating repeatable,...
- Insiders Can Ruin Your Company. Take Action.
- Did you know that 80 percent of threats to an organization come from the inside? The threat from insiders is often overlooked in...
- Top Solutions and Tools to Prevent Devastating Malware
- Custom malware frequently goes undetected. According to Forrester Research, the best way to reduce risk of breach is to deploy file integrity monitoring... All Operating Systems White Papers
- Optimizing Networks for the Cloud
- Join guest speaker, Rohit Mehra, IDC Director of Enterprise Communications Infrastructure, to explore current trends, discuss best practices for optimizing Data Center and...
- Apps QuickStart Series Part 2: Designing and Deploying SQL Server on VMware vSphere
- Download this webcast to learn about the design considerations for virtualizing SQL workloads, performance and scalability information and high-availability options, as well as...
- Apps QuickStart Series Part 1: Designing and Deploying Exchange 2010 on VMware vSphere
- Download this webcast to learn the virtual hardware design considerations for Exchange 2010, deployment using the building block approach, options for high-availability and...
- Customer Spotlight: How IPC The Hospitalist Company Implemented Oracle on VMware
- Have you been looking to hear about customer's experiences with the new VMware vCenter Site Recovery Manager product? View this webcast to learn...
- Virtualize Business-Critical Applications with Confidence
- Virtualizing business-critical applications has become a key focus for organizations as they move along their virtualization journey. With the launch of VMware vSphere®... All Operating Systems Webcasts