Reprinted-super-practical 8 Linux Command Line performance monitoring tools

Source: Internet
Author: User
ArticleDirectory
    •  

Linux R & D practice performance monitoring tools

Abstract:This article summarizes eight very practical Linux Command Line performance monitoring tools. These commands support all Linux systems and can be used not only to monitor the system, but also to identify the causes of performance problems.

For every system/Network Administrator, daily monitoring of Linux system performance is a very arduous task. After five years of working as a Linux system administrator in the IT industry, I found that it is not easy to monitor and keep the system running normally, I have summarized eight very useful command line tools for Linux/Unix system administrators. These commands support all Linux systems. They can be used not only to monitor the system, but also to identify the causes of performance problems. The following eight commands are sufficient for you to select one of them for your scenario.

1. Top -- Linux Process Monitoring

Linux TOP Command is a performance monitoringProgramMany Linux system administrators often use it to monitor system performance. The top command displays all running real-time processes in the form of a list and regularly updates them. It displays CPU usage, memory usage, swap memory, cache size, buffer size, flow PID, user, command, and so on. It also displays high memory processes and CPU usage in progress. It is very useful for the system administrator to use top for monitoring, and it can help the Administrator to take correct measures when necessary. Next let's take a look at the actual use of the top command!

 
  
  
  1. # Top

For more examples of top commands, refer to the 12 Use Cases of top commands on Linux.

2. vmstat-Virtual Memory statistics

The vmstat command in Linux is used to display virtual memory statistics, such as kernerl threads, disks, system processes, I/O modules, interruptions, and CPU activity. By default, you need to install a sysstat package on Linux to use the vmstat command. The command format is as follows:

 
  
  
  1. # Vmstat
  2. Procs ----------- memory ---------- --- swap -- ----- Io ---- System -- ----- CPU -----
  3. R B SWPD free Inact active Si so Bi Bo in CS us Sy ID wa st
  4. 1 0 0 810420 97380 70628 0 115 4 89 79 1 6 90 3 0

For more examples of using the vmstat command, see the six Use Cases of vmstat in Linux.

3. lsof -- list opened files

Like many Linux/Unix system commands, lsof is used to display all opened files and processes. These open files include disk files, network sockets, pipelines, devices, and processes. The main reason for using it is that when the file system is detached, if there is any open file in the file system, the Operation will usually fail, then lsof can be used to find out which processes are in use, the most common format of this command is as follows:

 
 
  1. # Lsof
  2. Command PID user FD type device size node name
  3. Init 1 root CWD dir 104,2 4096 2/
  4. Init 1 root RTD dir 104,2 4096 2/
  5. Init 1 root TXT Reg 38652 17710339/sbin/init
  6. Init 1 root mem Reg 129900 196453/lib/ld-2.5.so
  7. Init 1 root mem Reg 1693812 196454/lib/libc-2.5.so
  8. Init 1 root mem Reg 20668 196479/lib/libdl-2.5.so
  9. Init 1 root mem Reg 104,2 245376 196419/lib/libsepol. so.1
  10. Init 1 root mem Reg 104,2 93508 196431/lib/libselinux. so.1
  11. Init 1 root 10u FIFO 953/dev/initctl

For more instructions on how to use lsof, refer to the 10 Use Cases of lsof commands in Linux.

4. tcpdump-network packet Analyzer

Tcpdump is the most widely used command line-network packet analyzer or packet sniffing program used to capture or filter TCP/IP packets received or transferred from a specific network interface. It also saves the captured package to a folder. Tcpdump can be used on all major Linux distributions.

 
  
  
  1. # Tcpdump-I eth0
  2. Tcpdump: verbose output suppressed, use-V or-VV for full protocol decode
  3. Listening On eth0, link-type en10mb (Ethernet), capture size 96 bytes
  4. 22:08:59. 617628 IP tecmint.com. Ssh> 115.113.134.3.static-mumbai.vsnl.net. in.28472: P 2532133365: 2532133481 (116) ack 3561562349 win 9648
  5. 22:09:07. 653466 IP tecmint.com. Ssh> 115.113.134.3.static-mumbai.vsnl.net. in.28472: P am (116) ack 1 win 9648
  6. 22:08:59. 617916 IP 115.113.134.3.static-mumbai.vsnl.net. in.28472> tecmint.com. Ssh:. Ack 116 win 64347

For more use cases of tcpdump, see the following 12 Use Cases of the tcpdump command in Linux:

5. netstat-network statistics

Netstat is a command line tool used to monitor incoming and outgoing network packet information and interface information statistics. The system administrator can use it to monitor network performance and troubleshoot network problems.

 
 
  1. # Netstat-A | more
  2. Active Internet connections (servers and established)
  3. PROTO Recv-Q send-Q local address foreign address State
  4. TCP 0 0 *: MySQL *: * listen
  5. TCP 0 0 *: SunRPC *: * listen
  6. TCP 0 0 *: realm-rusd *: * listen
  7. TCP 0 0 *: ftp *: * listen
  8. TCP 0 0 localhost. localdomain: IPP *: * listen
  9. TCP 0 0 localhost. localdomain: SMTP *: * listen
  10. TCP 0 0 localhost. localdomain: SMTP localhost. localdomain: 42709 time_wait
  11. TCP 0 0 localhost. localdomain: SMTP localhost. localdomain: 42710 time_wait
  12. TCP 0 0 *: HTTP *: * listen
  13. TCP 0 0 *: SSH *: * listen
  14. TCP 0 0 *: https *: * listen

For more use cases of netstat, refer to the 20 Use Cases of netstat on Linux.

6. htop-Linux Process Monitoring

Htop is a more advanced interactive and real-time Linux Process Monitoring Tool. This command is similar to the top command, but has more functions, such as friendly user interface process management, shortcut keys, vertical and horizontal view processes. Htop is a third-party plug-in tool. You must use the yum software package management tool to install it on Linux.

Htop installation instructions: Install htop in Linux (Linux Process Monitoring)

7. lotop -- monitors Linux disk I/O

Lotop is similar to the top command and the htop program, but it has the statistical function to monitor and display disk I/O in real time. This tool is very useful for precise processes and for discovering high-usage read/write processes.

Loptop installation instructions: Install loptop in Linux

8. iostat -- input/output statistics

Iostat is a simple tool used to collect and display statistics of system input and output storage devices. This tool is usually used to track the performance of storage devices, including devices, local disks, remote disks, such as NFS.

  
  
  1. # iostat
  2. Linux 2.6.18-238.9.1.el5 (tecmint.com) 09/13/2012
  3. AVG-CPU: % USER % nice % System % iowait % steal % idle
  4. 2.60 3.65 1.04 4.29 0.00 88.42
  5. device: TPS blk_read/s blk_wrtn/s blk_read blk_wrtn
  6. CCISS/c0d0 17.79 545.80 256.52 855159769 401914750
  7. CCISS/c0d0p1 0.00 0.00 0.00 5459 3518
  8. CCISS/c0d0p2 16.45 533.97 245.18 836631746 384153384
  9. CCISS/c0d0p3 0.63 5.58 3.97 8737650
  10. CCISS/c0d0p4 0.00 0.00 0.00 8 0
  11. CCISS/c0d0p5 0.63 3.79 5.03 5936778 7882528
  12. CCISS/c0d0p6 0.08 2.46 2.34 3847771 3659776

For more iostat examples and instructions, read: Six Use Cases of the iostat command on Linux (Zhang hongyue/compilation)

Original article: tecmint

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.