2-Minute Linux Tip: How to use the top command

Network World | Jun 19, 2018

In today’s Linux tip, we’re going to look at top – a favorite tool for examining performance on a Linux system. Want to pinpoint why your Linux system is running slowly? Top can shed a lot of light on that.

Similar
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on Network World.
In today’s Linux tip, we’re going to look at top – one of my favorite tools for examining performance on a Linux system. Want to pinpoint why your Linux system is running slowly? Top can shed a lot of light on that.
top provides stats on some of the most important performance measurements – allowing us to get an idea how busy our system is and why.
To start top, just type top in a terminal window. As you can see, I’ve already got it running and my display is updating every 4-5 seconds.
So, what might we want to focus on?
1. Which tasks are using up a lot of CPU time – they’ll be at on the top of the list we see displayed. On the left, you can see the process IDs and who is running them.
2. How many tasks are waiting on average to get access to the CPU. We see 5-, 10-, 15-minute averages. If an average = 0.05. we’d have a process waiting to be run 1/20th of the time. And, given the 3 stats, we can tell whether the system is getting busier or less busy.
3. We can also see how much memory is free
4. Whether significant swap space is being used
In addition, top shows us …
o How many tasks are being run overall
o And how long the system has been up
Type q to quit, top to start it up again
If you type top -u , you’ll limit the display to one particular user
Interactively, we can type:
z to highlight the top process (the one using the most CPU time)
c to display complete paths
k to kill a task (we’ll be prompted for the PID –and must have sufficient privilege)
Top is one of the best commands for getting a quick view of how a system’s performing and pinpointing why it’s slow.

That’s your Linux tip for today. If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.
Popular