Linux - Command to Monitor Linux Performance



1. Top – Linux Process Monitoring

 Linux Top command is a performance monitoring program

It display CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size, Process PID, User, Commands and much more. It also shows high memory and cpu utilization of a running processess

#top

to quit this monitoring  just click   --  q
 








2. vmstat

Linux VmStat command used to display statistics of virtual memory, kernerl threads, disks, system processes, I/O blocks, interrupts, CPU activity.

# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 320188 168920  35492 7313760    0    0     1     5    0    0  0  0 100  0  0


3.lsof

Lsof command used in many Linux/Unix like system that is used to display list of all the open files and the processes. The open files included are disk files, network sockets, pipes, devices and processes

4. netstat

# netstat
 

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0     64 10.191.7.11:ssh             10.35.9.106:61321           ESTABLISHED
tcp        0      0 localhost:41486             localhost:ncube-lm          ESTABLISHED
tcp        0      0 localhost:ncube-lm          localhost:41486             ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ]         DGRAM                    8468   @/org/kernel/udev/udevd
unix  2      [ ]         DGRAM                    13069  @/org/freedesktop/hal/udev_event
unix  18     [ ]         DGRAM                    11936  /dev/log


5. iotop

Iotop is also much similar to top command , but it has accounting function to monitor and display real time Disk I/O and processes.

To quit just press - q  button

#iotop
 
Total DISK READ: 0.00 B/s | Total DISK WRITE: 98.09 K/s
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND
28555 be/4 oracle      0.00 B/s   83.00 K/s  0.00 %  0.07 % ora_dbw0_ebportaldr
 1444 be/3 root        0.00 B/s    0.00 B/s  0.00 %  0.02 % [jbd2/dm-12-8]
12140 be/4 oracle      0.00 B/s   63.52 M/s  0.00 %  0.00 % scp -d -t /datadump
    1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init
    2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
    3 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
    4 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
    5 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
 


6. iostat

IoStat is simple tool that will collect and show system input and output storage device statistics. This tool is often used to trace storage device performance issues including devices, local disks, remote disks such as NFS.
# iostat
Linux 2.6.32-431.el6.x86_64 (ITPFEBPAS0816P)    02/24/2016      _x86_64_        (8 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.09    0.00    0.04    0.00    0.00   99.87

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               1.05        22.52        79.86  151549136  537396444
dm-0              0.02         0.05         0.13     341936     892448
dm-1              0.11         0.43         0.82    2862842    5486432
dm-2              0.00         0.00         0.00       2002        328
dm-3              0.00         0.00         0.00       2002        328
dm-4              0.00         0.00         0.00       2002        328
dm-5              0.00         0.00         0.00       2002        328
dm-6              0.00         0.00         0.00       2002        328
dm-7              0.86         0.00         6.86       3418   46150312
dm-8              2.16         8.47        16.95   57009322  114063960
dm-9              0.00         0.00         0.00       2594       7648
dm-10             0.25         0.03         1.97     180978   13257808
dm-11             0.00         0.00         0.00       1858        192
dm-12             1.24         1.08         9.15    7278826   61558600
dm-13             0.17         0.09         1.33     598210    8941736
dm-14             4.15        12.35        32.77   83108074  220523752
dm-15             0.00         0.00         0.00       2482       3760
dm-16             0.39         0.00         3.12       2418   20976408
dm-17             0.00         0.00         0.00       2002        328
dm-18             0.00         0.00         0.00       2002        328
dm-19             0.74         0.01         5.80      74554   39013888
dm-20             0.00         0.00         0.00       2170        328
dm-21             0.00         0.00         0.00       2002        328
dm-22             0.12         0.00         0.97      27850    6515024
dm-23             0.00         0.00         0.00       1986        280
dm-24             0.00         0.00         0.00       1986        280
dm-25             0.00         0.00         0.00       1986        280
dm-26             0.00         0.00         0.00       1986        280
dm-27             0.00         0.00         0.00       1986        280

Post a Comment

And that's all there is to it!

If anyone has any other questions or requests for future How To posts, you can either ask them in the comments or email me. Please don't feel shy at all!

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

Previous Post Next Post