Ultra-Practical 8 Linux command line performance monitoring tools

Source: Internet
Author: User
Tags ack

Monitoring Linux system performance every day is a daunting task for every system/network administrator. After 5 years of Linux system administrators in the IT industry, I found it's not easy to monitor and keep the system up and running, so I've summed up 8 very useful command-line tools for Linux/unix system administrators. These commands support all Linux systems and can be used not only to monitor the system, but also to identify the cause of performance problems. The 8 commands provided below are sufficient for you to select one of them for your scene.

1.top--linux Process Monitoring

The top command of Linux is a performance Monitor that many Linux system administrators often use to monitor system performance, and the top command displays all running real-time processes in a list and updates periodically. It shows CPU usage, memory usage, swap memory, cache size, buffer size, process PID, user, command, and so on. It also shows the high memory processes and CPU utilization that are running. It is useful for system administrators to use top for monitoring and to help administrators take the right steps if necessary. Let's take a look at the actual use of the top command!

    1. # Top

Top command More examples of use, you can read: Top command on Linux 12 use cases

2.vmstat--Virtual Memory Statistics

The Linux vmstat command is used to display virtual memory statistics, Kernerl threads, disks, system processes, I/O modules, interrupts, CPU activity, and so on. By default, you need to install a Sysstat package on a Linux system to use the Vmstat command. The command is used in the following format:

    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 0 115 4 89 79 1 6 90 3 0

For more examples of using the Vmstat command, read: Vmstat 6 use cases in Linux

3.lsof--to list open files

The lsof command, like many Linux/unix system commands, is used to display all open files and processes. These open files include disk files, network sockets, pipelines, devices, and processes. The main reason for using it is that when you unmount the file system, if there are any open files in the file system, the operation will usually fail, then through Lsof can find out which processes are in use, the most common format for 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 104,2 38652 17710339/sbin/init
  6. Init 1 root mem REG 104,2 129900 196453/lib/ld-2.5.so
  7. Init 1 root mem REG 104,2 1693812 196454/lib/libc-2.5.so
  8. Init 1 root mem REG 104,2 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 0,17 953/dev/initctl

For more lsof instructions please read: The lsof command in Linux 10 use cases

4.tcpdump--Network Packet Analyzer

Tcpdump is the most widely used command line-the network packet Analyzer or packet sniffer program-to capture or filter TCP/IP packets received or transferred from a specific interface on the network. 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 bytes
  4. 22:08:59.617628 IP tecmint.com.ssh > 115.113.134.3.static-mumbai.vsnl.net.in.28472:p 2,532,133,365:2,532,133,481 ( ) Ack 3561562349 win 9648
  5. 22:09:07.653466 IP tecmint.com.ssh > 115.113.134.3.static-mumbai.vsnl.net.in.28472:p 116:232 ($) Ack 1 win 9648
  6. 22:08:59.617916 IP 115.113.134.3.static-mumbai.vsnl.net.in.28472 > Tecmint.com.ssh:. Ack, Win 64347

For more tcpdump use cases, please read: The tcpdump command 12 use cases in Linux systems

5.netstat--Network Statistics

Netstat is a command-line tool for monitoring incoming and outgoing network packet information and interface information statistics. It is useful for system administrators to use it to monitor network performance and troubleshoot network-related issues.

  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 netstat use cases, please read: Netstat 20 use cases on Linux

6.htop--linux Process Monitoring

Htop is a more advanced interactive and real-time Linux process monitoring tool. This command is very similar to the top command, but it is more versatile, such as friendly user interface process management, shortcut keys, vertical and horizontal view processes, and more. Htop is a third-party plug-in tool that you need to install on a Linux system using the Yum Package management tool.

Htop Installation Instructions: Installing Htop in Linux (Linux process monitoring)

7.lotop--Monitoring Linux disk I/O

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

Loptop Installation Instructions: Installing Loptop in Linux

8.iostat--Input/Output statistics

Iostat is a very simple tool for collecting and displaying system input and output storage device statistics. This tool is typically used to track performance issues with 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 6215544
  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 use examples and instructions, read: The Iostat command on Linux 6 use cases

Ultra-Practical 8 Linux command line performance monitoring tools

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.