In this series, I’ll look at some of the ways you can examine your
system to see what’s taking up resources, and offer some tips on
slimming your system down so it runs faster.
I’ll start with two of the basic command-line applications
for measuring performance: top and ps.
When you suspect something is running away with system resources,
top should be your first recourse. It gives you a screen
that updates every couple of seconds, showing you a list
of the processes that are hogging the most CPU.
The fields, in order, are:
Top has some useful options, too. For instance, if you want to run
top just once and save its output into a file, you can do it like this:
top -b -n 1
When you’re running top interactively, you can change the way it sorts:
type M to sort by memory use rather than CPU, T to sort by total time,
or P to go back to sorting by CPU. Those letters are all capitalized.
PID TTY TIME CMD 13978 pts/200:00:00 bash 15375 pts/200:00:00 ps
Add a u (no dash in front of it) to get a lot more information
in “user-oriented format”:
(imbrium)- ps u USERPID %CPU %MEMVSZRSS TTY STAT STARTTIME COMMAND akkana3848 0.0 0.04188 2084 tty1 S08:460:00 -tcsh akkana3905 0.0 0.03504 1552 tty1 S+08:460:00 /bin/bash /usr/ akkana3965 0.0 0.02904824 tty1 S+08:460:00 xinit /home/akk akkana4022 0.0 0.01868504 tty1 S08:460:00 sh /home/akkana akkana4032 0.0 0.19232 3664 tty1 S08:460:00 xterm -geometry akkana4034 0.0 0.05572 2840 tty1 S08:460:00 /usr/bin/python akkana4038 0.0 0.2 12356 7364 tty1 S08:460:01 openbox akkana4040 0.0 0.03976 2000 pts/0Ss08:460:00 -tcsh akkana4057 0.0 0.03140716 tty1 S08:460:00 dbus-launch --a akkana4065 0.0 0.01868532 tty1 S08:460:00 /bin/sh /usr/lo akkana4070 0.0 0.01868548 tty1 S08:460:00 /bin/sh /usr/lo akkana4074 0.7 3.1 261620 98948 tty1 Sl08:461:33 /usr/local/fire akkana4132 0.0 0.18796 3588 tty1 S08:490:00 xterm -geometry akkana4133 0.0 0.04456 2576 pts/1Ss+ 08:490:00 -tcsh akkana4598 0.0 0.18684 4952 pts/0S+08:510:00 mutt akkana5221 0.0 0.5 26340 17124 tty1 S09:030:05 emacs akkana12067 0.0 0.4 27612 13044 tty1 Sl11:050:00 python /home/ak akkana13535 0.0 0.6 33096 18624 tty1 S11:460:01 /usr/local/bin/ akkana13977 0.0 0.18788 5472 pts/1S11:570:00 xterm -bg white akkana13978 0.0 0.03964 2048 pts/2Ss11:570:00 -tcsh akkana15400 0.0 0.02704976 pts/2R+12:240:00 ps u
The fields pretty much mirror the ones you see in top, with
slightly different names and units.
You may notice that ps u only shows you processes owned by you.
When you’re trying to speed up your system, don’t forget about system
processes. Sometimes they can take up a significant amount of time.
ps uax will show all processes: the a means “all processes”,
but despite that, it doesn’t really show all processes until
you tack on the x to show processes that aren’t attached to
any terminal — for instance, processes that were started when your
system booted.
One thing you may have noticed about ps output is that it isn’t sorted
in any useful order. For instance, take this output of ps uax:
(imbrium)- ps uax USERPID %CPU %MEMVSZRSS TTY STAT STARTTIME COMMAND root 1 0.0 0.03080 1884 ?Ss08:450:00 /sbin/init root 2 0.0 0.0 0 0 ?S It goes on, but you get the idea: the list is obviously sorted by process ID. It would make a lot more sense to sort by CPU or memory use, especially when you're trying to speed up your system. So you can specify a sort order, like:ps uax --sort=-rssto sort by memory use (resident set size). The dash in front of rss
tells ps to put the biggest processes first.
Other useful sort options are -pcpu, to sort by CPU use
and -time to sort by cumulative time the process has ued.You can also use those specifiers to indicate what fields ps will show,
in case you're not interested in details like Status, Start time, Priority
and so forth.
For the full list of parameters you can use, search for
STANDARD FORMAT SPECIFIERS in the ps manual page.For instance, here's a useful ps command that gives much more useful
output:ps ax --sort=-pcpu o user,pid,pcpu,pmem,vsz,rss,stat,time,commOf course, you wouldn't want to type that every time. So choose a set
of arguments that make sense to you, and make a shell
alias in your .bashrc file:alias psall "ps ax --sort=-pcpu o user,pid,pcpu,pmem,vsz,rss,stat,time,comm"
Akkana Peck is a freelance programmer and author of the book
Beginning GIMP: From Novice to Professional.
She'll be discussing some techniques for speeding up Linux in a talk at
OSCON this Wednesday.
Her website is is shallowsky.com.Article courtesy of Linux Planet.
Ethics and Artificial Intelligence: Driving Greater Equality
FEATURE | By James Maguire,
December 16, 2020
AI vs. Machine Learning vs. Deep Learning
FEATURE | By Cynthia Harvey,
December 11, 2020
Huawei’s AI Update: Things Are Moving Faster Than We Think
FEATURE | By Rob Enderle,
December 04, 2020
Keeping Machine Learning Algorithms Honest in the ‘Ethics-First’ Era
ARTIFICIAL INTELLIGENCE | By Guest Author,
November 18, 2020
Key Trends in Chatbots and RPA
FEATURE | By Guest Author,
November 10, 2020
FEATURE | By Samuel Greengard,
November 05, 2020
ARTIFICIAL INTELLIGENCE | By Guest Author,
November 02, 2020
How Intel’s Work With Autonomous Cars Could Redefine General Purpose AI
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
October 29, 2020
Dell Technologies World: Weaving Together Human And Machine Interaction For AI And Robotics
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
October 23, 2020
The Super Moderator, or How IBM Project Debater Could Save Social Media
FEATURE | By Rob Enderle,
October 16, 2020
FEATURE | By Cynthia Harvey,
October 07, 2020
ARTIFICIAL INTELLIGENCE | By Guest Author,
October 05, 2020
CIOs Discuss the Promise of AI and Data Science
FEATURE | By Guest Author,
September 25, 2020
Microsoft Is Building An AI Product That Could Predict The Future
FEATURE | By Rob Enderle,
September 25, 2020
Top 10 Machine Learning Companies 2021
FEATURE | By Cynthia Harvey,
September 22, 2020
NVIDIA and ARM: Massively Changing The AI Landscape
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
September 18, 2020
Continuous Intelligence: Expert Discussion [Video and Podcast]
ARTIFICIAL INTELLIGENCE | By James Maguire,
September 14, 2020
Artificial Intelligence: Governance and Ethics [Video]
ARTIFICIAL INTELLIGENCE | By James Maguire,
September 13, 2020
IBM Watson At The US Open: Showcasing The Power Of A Mature Enterprise-Class AI
FEATURE | By Rob Enderle,
September 11, 2020
Artificial Intelligence: Perception vs. Reality
FEATURE | By James Maguire,
September 09, 2020
Datamation is the leading industry resource for B2B data professionals and technology buyers. Datamation's focus is on providing insight into the latest trends and innovation in AI, data security, big data, and more, along with in-depth product recommendations and comparisons. More than 1.7M users gain insight and guidance from Datamation every year.
Advertise with TechnologyAdvice on Datamation and our other data and technology-focused platforms.
Advertise with Us
Property of TechnologyAdvice.
© 2025 TechnologyAdvice. All Rights Reserved
Advertiser Disclosure: Some of the products that appear on this
site are from companies from which TechnologyAdvice receives
compensation. This compensation may impact how and where products
appear on this site including, for example, the order in which
they appear. TechnologyAdvice does not include all companies
or all types of products available in the marketplace.