Linux View System Status command
Iostat
The Iostat command shows the storage subsystem in detail. You typically use Iostat to monitor the overall health of the storage subsystem, and to detect slow input/output problems before the user notices that the server is running slowly. Believe me, you should find these problems before users find them!
Meminfo and free
Meminfo shows you the memory situation in detail. You can usually use another program, such as Cat and grep, to access the Meminfo information. For example, Cat/proc/meminfo shows you the usage of the server's memory at any one time in detail.
You can use the free command if you want to get a quick overview of the memory. In short, free gives you a summary of the information, and Meminfo provides you with detailed information.
Mpsta
The Mpstat command can report the activity of each processor available on a multiprocessor server. Today, because of multicore processors, this command is available for almost any server. Mpstat can also report the average activity of processors on all servers. It allows you to display the total processor statistics by system or by processor. This profile can alert you to potential application problems before they annoy users.
netstat
Netstat, like PS, is the Linux tool that Linux administrators use every day. It shows a large amount of information about the network, such as the set of interface usage, routing, interfaces, protocols, network statistics, and more. Some of the most common options are as follows:
-A display all information of the socket interface
-R Display Routing information
-I display statistics for network interfaces
-S displays statistics for network protocols
Nmon
Nmon is the abbreviation for Nigel's Monitor, a popular open source tool used to monitor the performance of Linux systems. Nmon can monitor performance information for multiple subsystems, such as processor utilization, memory usage, run queue information, disk input/output statistics, network input/output statistics, memory paging activity, and process metrics. You can then view Nmon's real-time system measurements by curses the "graphical" interface.
To run Nmon, you can start the tool from the shell. Once started, you can choose which subsystem to monitor by simply entering a single-touch command. For example, to get statistics on the processor, memory, and disk, just enter C, M, and D respectively. You can also use Nmon with the-f flag to save performance statistics to a CSV file for later analysis.
In terms of daily server monitoring, I think Nmon is one of the most useful programs in my Linux System Management Toolkit.
Pmap
The PMAP command is used to report the amount of memory used by the server's process. You can use this tool to determine which processes on the server are allocated memory, and who is using memory in a large number of these processes.
PS and Pstree
The two commands for PS and Pstree are the two right-hand assistants for Linux system administrators. They all display all currently running processes in the form of a list. PS can tell you how much memory and processor time the server's program is using. Pstree displays less information, but highlights which processes are child processes of other processes. With this information in hand, you will be able to detect runaway processes and then use the Linux Kill command with no survivors to terminate these processes.
SAR
The SAR program is like the Swiss * * * in the field of system monitoring tools. The SAR command actually consists of three programs: the SAR that displays the data, the SA1 that collects the data, and the SA2 that holds the data. Once installed, the SAR can generate detailed profile information showing processor usage, memory paging activity, network input/output and transmission statistics, Process creation activity and disk device activity. One big difference between SAR and Nmon is that the former is more suitable for long-term monitoring systems, and I think Nmon is better suited to help me quickly check the health of the server.
Strace
Strace is often considered a programmer's debugging tool, but its function is not just for debugging. It can intercept and record the situation of the process calling system. Thus, it is a practical tool for diagnosis, teaching and debugging. For example, you can use Strace to find out which profile a program actually uses when it starts.
But Strace does have a flaw. When it checks a process, the performance of the process is plummeted. Therefore, the use of strace is only possible if I have had very good reason to think that a program is causing problems.
tcpdump
The tcpdump is a simple and reliable network monitoring utility. Its basic protocol analysis feature gives you a rough view of what's happening on your network. But to really delve into the network, you should use Wireshark (described below).
Top
The top command shows the status of the active process. By default, it shows the most processor-intensive tasks running on the server, and refreshes the list every 5 seconds. You can also classify processes by multiple criteria, such as PID (process ID), age, the latest column at the top, time, by cumulative time, and the total time it takes to host memory usage and use the processor since startup. I think it provides a quick and easy way to see if any process is starting to get out of control and causing problems.
Uptime
Uptime can be used to see how long a server has been running and how many users are logged on. It also shows a summary of the server's average load. The optimal value for the load is 1 or less, which means that each process can immediately access the processor and there is no case of processor cycle loss.
Vmstat
In general, you can use Vmstat to monitor virtual memory. Linux is constantly using virtual memory to achieve optimal storage performance.
If your application is consuming too much memory, you will experience frequent swapping out of memory (page-out)-The swap space from memory to the system hard drive. Your server may go into this phase: it spends more time managing memory paging than it spends on running applications-this is known as jitter (thrashing). When your computer shakes, performance is plummeted. Vmstat can display average data or actual samples, which can help you discover a lot of memory-consuming programs and processes, lest they cause the server to run like a snail.
Wireshark
Wireshark, previously known as ethereal (and still often called this), is Tcpdump's similar tool, but it is more advanced and has much more advanced protocol analysis and reporting capabilities. Wireshark has both GUI interface and Shell interface. If you are engaged in professional-level network management, you can only use ethereal. And if you're using wireshark/ethereal, I highly recommend reading the "Practical Packet Analysis" by Chris Sander (practical Packet Analyst) , the book provides an in-depth overview of how to make the most of the utility program.
system
# uname-a # view kernel/Os/cpu information
# head-n 1/etc/issue # view OS version
# cat/proc/cpuinfo # View CPU Information
# hostname # view computer name
# LSPCI-TV # list all PCI devices
# LSUSB-TV # list all USB devices
# lsmod # List of loaded kernel modules
# env # view Environment Variables
Resources
# free-m # View memory usage and swap area usage
# df-h # View the usage of each partition
# du-sh # View the size of the specified directory
# grep Memtotal/proc/meminfo # view Total Memory
# grep Memfree/proc/meminfo # View the amount of free memory
# uptime # View System uptime, number of users, load
# cat/proc/loadavg # view System load
disks and Partitions
# Mount | column-t # View the status of the attached partition
# fdisk-l # View all partitions
# swapon-s # View all swap partitions
# hdparm-i/dev/hda # View disk parameters (for IDE devices only)
# DMESG | grep IDE # view IDE device detection at startup
Network
# ifconfig # View the properties of all network interfaces
# iptables-l # view firewall settings
# route-n # View the routing 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 # Real-time display of process status
User
# w # View active Users
# ID # view specified user information
# Last # View user log in log
# cut-d:-f1/etc/passwd # View All users of the system
# cut-d:-f1/etc/group # View all system groups
# crontab-l # View Current user's scheduled Tasks
Service
# chkconfig-list # list all system services
# Chkconfig-list | grep on # list all started system services
program
# rpm-qa # View all installed packages
Linux View System Status command