Skip the navigation
Opinion

Looking at the changes to Snow Leopard's top command

By Rob Griffiths
November 12, 2009 02:09 PM ET

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.

Originally published on www.macworld.com. Click here to read the original story.
Reprinted with permission from Macworld.com. Story copyright 2010 Mac Publishing, LLC. All rights reserved.
Additional Resources
Forrester Consulting - Optimizing Users and Applications in a Mobile World
WHITE PAPER
Solving application issues over the WAN requires careful consideration. Based on their independent research, Forrester Consulting offers recommendations on how to tackle application performance issues, insufficient bandwidth and the inability to quickly restore users in a disaster.

Read now.

Security KnowledgeVault
WHITE PAPER
Security is not an option. This KnowledgeVault Series offers professional advice how to be proactive in the fight against cybercrimes and multi-layered security threats; how to adopt a holistic approach to protecting and managing data; and how to hire a qualified security assessor. Make security your Number 1 priority.

Read now.

Cut Communications Costs Once and for All
WHITE PAPER
New IP-based communications systems are being deployed by small and midsized businesses at a rapid rate. Learn how these organizations are enabling faster responsiveness, creating better customer experiences, speeding office or mobile interactions, and dramatically reducing existing communications costs.

Read now.

Operating Systems White Papers
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
Operating Systems Webcasts
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
Newsletter Sign-Up

Receive the latest news test, reviews and trends on your favorite technology topics

Choose a newsletter
  1. View all newsletters | Privacy Policy
IT Jobs