Command for viewing system status in Linux

Source: Internet
Author: User

Command for viewing system status in Linux

Iostat

The iostat command details the storage subsystem. You usually use iostat to monitor the running status of the storage subsystem, and detect the slow input/output before the user notices that the server is running slowly. Believe me, you should discover these problems before the user discovers them!

Meminfo and free

Meminfo displays the memory details for you. You can use another program, such as cat and grep, to access meminfo information. For example, cat/proc/meminfo shows you the usage of the server at any time.

If you want to quickly understand the memory summary, you can use the free command. In short, free provides you with summary information; meminfo provides you with details.

Mpsta

The mpstat command can report the activity of each available processor on a multi-processor server. Today, thanks to the multi-core processor, this command applies to almost all servers. Mpstat can also report the average active status of processors on all servers. It enables you to display the total processor statistics by system or by processor. This summary information can be noticed before potential application problems can cause users.

Netstat

Like ps, netstat is also a Linux tool used by Linux administrators every day. It displays a large amount of information related to the network, such as the usage of the Set interface, routing, interface, protocol, network statistics, and more information. The most common options are as follows:

-A: displays all information of the Set interface.

-R: Display route information

-I: displays the statistics of network interfaces.

-S: displays network protocol statistics

Nmon

Nmon is the short name of the Nigel's Monitor. This popular open-source tool is used to Monitor the performance of Linux systems. Nmon can monitor the performance information of multiple subsystems, such as processor usage, memory usage, running queue information, disk input/output statistics, network input/output statistics, memory paging activity, and Process metrics. Then, you can view the real-time system measurement result of nmon on the curses "Graphical" interface.

To run nmon, you can start the tool from the shell. Once started, you only need to enter the single-key command to select the subsystem to be monitored. For example, if you want to obtain statistics on the processor, memory, and disk, you only need to input c, m, and d. you can also use nmon with the-f flag to save the performance statistics to a CSV file for future analysis.

In terms of daily server monitoring, I think nmon is the most useful program in my Linux system management toolkit.

Pmap

The pmap command is used to report the memory used by the server process. You can use this tool to determine which processes on the server are allocated with memory and who are using large amounts of memory.

Ps and pstree

The ps and pstree commands are two effective assistants of the Linux system administrator. They all display all processes currently running in the form of a list. Ps can tell you How much memory and processor time the server program is using. Pstree displays less information, but focuses on the processes that are sub-processes of other processes. With this information, you can discover out-of-control processes and use the kill command of Linux to terminate these processes.

Sar

Sar programs are like Swiss Army knives in the field of system monitoring tools. The sar command is actually composed of three programs: sar that displays data, sa1 that collects data, and sa2. once the data is installed, sar can generate detailed summary information, displays statistics on CPU usage, memory paging activity, network input/output, and transmission, process creation activity, and disk device activity. One major difference between sar and nmon is that the former is more suitable for long-term monitoring systems, and I think nmon is more suitable for helping me quickly view the running status of servers.

Strace

Strace is often considered a programmer's debugging tool, but its function is not only used for debugging. It can intercept and record system calls by processes. Therefore, it is a practical diagnostic, teaching and debugging tool. For example, you can use strace to find out which configuration file a program uses at startup.

However, strace does have a defect. When it checks a process, the performance of the process will plummet. Therefore, strace is used only when I think that a program causes a problem for an extremely good reason.

Tcpdump

Tcpdump is a simple and reliable network monitoring utility. Its basic protocol analysis function allows you to roughly Check network conditions. However, to analyze the network situation in depth, you should use Wireshark (introduced below ).

Top

The top command displays the status of active processes. By default, it displays the task of the most consumable processor running on the server, and refreshes the list every five seconds. You can also classify processes according to multiple criteria, such as PID (process ID); age, latest column at the beginning; time, by accumulative time; as well as resident memory usage and the total time it has been using the processor since startup. I think it provides a fast and easy way to check whether the process is about to get out of control and cause problems.

Uptime

Uptime can be used to view how long a server has been running and how many users have logged on to it. It also displays the summary of the average server load. The best load value is 1 or smaller, which means that each process can access the processor immediately without any loss of the processor cycle.

Vmstat

In general, you can use vmstat to monitor the virtual memory. Linux constantly uses virtual memory to achieve optimal storage performance.

If your application occupies too much memory, you will encounter frequent page-out (page-out) situations-that is, the swap space from the program memory to the system hard drive. Your server may enter this stage: It takes more time to manage memory pages than to run applications-a situation called jitter ). When your computer is jitters, the performance will drop. Vmstat can display average data or actual samples to help you discover a large number of memory-consuming programs and processes, so that they do not cause the server to run as a snail bait.

Wireshark

Wireshark, formerly known as Ethereal (which is often called this), is a tool similar to tcpdump. However, Wireshark is more advanced with much advanced protocol analysis and reporting capabilities. Wireshark has both a GUI and a shell interface. If you are engaged in professional network management, you can only use ethereal. if you are using Wireshark/ethereal, I strongly recommend that you read Chris Sander's Practical Packet Analysis ), this book introduces how to make the most of this utility.

 

System
# Uname-a # view kernel/operating system/CPU Information
# Head-n 1/etc/issue # view the operating system version
# Cat/proc/cpuinfo # view CPU Information
# Hostname # view the computer name
# Lspci-TV # list all PCI devices
# Lsusb-TV # list all USB devices
# Lsmod # list loaded Kernel Modules
# Env # view environment variables
Resources
# Free-m # view memory usage and swap zone usage
# Df-h # view the usage of each partition
# Du-sh # view the size of a specified directory
# Grep MemTotal/proc/meminfo # view total memory
# Grep MemFree/proc/meminfo # view the Amount of idle memory
# Uptime # view system running time, number of users, and load
# Cat/proc/loadavg # view system load
Disks and partitions
# Mount | column-t # view the status of the mounted Partition
# Fdisk-l # view all partitions
# Swapon-s # view all swap partitions
# Hdparm-I/dev/hda # view disk parameters (only applicable to IDE devices)
# Dmesg | grep IDE # view the IDE Device Detection Status at startup
Network
# Ifconfig # view the attributes of all network interfaces
# Iptables-L # view firewall settings
# Route-n # view the route table
# Netstat-lntp # view all listening ports
# Netstat-antp # view all established connections
# Netstat-s # view network statistics
Process
# Ps-ef # view all processes
# Top # display Process status in real time
User
# W # view active users
# Id # view specified user information
# Last # view User Logon logs
# Cut-d:-f1/etc/passwd # view all users in the system
# Cut-d:-f1/etc/group # view all groups in the system
# Crontab-l # view the scheduled tasks of the current user
Service
# Chkconfig-list # list all system services
# Chkconfig-list | grep on # list all started system services
Program
# Rpm-qa # view all installed software packages

This article permanently updates the link address:

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.