12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

410CHAPTER 20Monitoring System ResourcesNOTEOther arguments are available; refer to the sar man page for details. It can beaccessed by executing the man sar command at a shell prompt.Reporting System ProcessesThe ps command outputs data about active processes. By default, it only displaysprocesses associated with the current terminal and owned by the user executing thecommand. To view all processes on the system from all users, use the command ps -aux.The output for all users and processes can be long. Piping it through less will help youscroll through the output: ps -aux | less. Piping it through grep can help you searchfor a specific process or user: ps -aux | grep bash. You can also redirect the output to afile for further analysis: ps -aux > psoutput.txt.NOTENumerous arguments to ps can be used to customize the output. A complete list isavailable in the ps man page.Alternatively, the top command shows similar information but on a continuous basis,and the data can be sorted by memory usage, CPU usage, process ID, and more. While pscan be used to generate snapshots of usage, top can be used to actively monitor thesystem. To stop top, press the q key. Example output is shown in Listing 20.6.LISTING 20.6Example top Outputtop - 15:41:45 up 16 days, 3:20, 6 users, load average: 0.12, 0.18, 0.09Tasks: 183 total, 1 running, 182 sleeping, 0 stopped, 0 zombieCpu(s): 8.5%us, 1.8%sy, 0.0%ni, 89.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%stMem: 1541120k total, 1521532k used, 19588k free, 67880k buffersSwap: 2031608k total, 140k used, 2031468k free, 335872k cachedPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND3183 root 15 0 425m 80m 12m S 14 5.3 54:58.87 Xorg6584 tfox 15 0 269m 14m 9748 S 7 0.9 0:10.49 gnome-system-mo3543 tfox 16 0 290m 24m 9508 S 0 1.7 0:11.80 gnome-terminal5326 root 20 0 267m 7020 1172 S 0 0.5 5:35.15 python6566 root 15 0 12708 1124 796 R 0 0.1 0:00.39 top1 root 15 0 10300 656 544 S 0 0.0 0:00.16 init2 root RT 0 0 0 0 S 0 0.0 0:00.03 migration/03 root 34 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/04 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/0An explanation of the headers displayed by top is in Table 20.3.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!