commands for viewing system resource usage in CentOS

Source: Internet
Author: User

Use ' top-i ' to see how many processes are in Running state, there may be memory or I/O bottlenecks in the system, use free to see the system memory usage, swap is occupied a lot, use Iostat to look at the I/O load situation ...

another way is to Ps-ef | sort-k7, sort the process by run time to see which process consumes the most CPU time.

Top:
Main parameters
D: Specifies the interval of the update, in seconds.
Q: There are no delayed updates. If the user has a superuser, the top command will be executed with the highest precedence.
C: Displays the full path and name of the process.
S: Cumulative mode, which accumulates the CPU time of a child stroke that has completed or disappeared.
S: Safe mode.
I: Do not display any idle (idle) or useless (Zombie) travel.
N: Displays the number of updates, and will exit to when completed
Display parameters:
PID (Process ID): progress indicator number.
User: The username of the process owner.
PR: The priority level of the process.
NI: The value of the priority level of the process.
VIRT: The virtual memory value that the process occupies.
RES: The physical memory value that the process occupies.
SHR: Shared memory value used by the process.
S: The state of the process, where s indicates hibernation, R is running, Z represents a zombie state, and N indicates that the process precedence value is negative.
%CPU: The CPU usage that the process consumes.
%MEM: The percentage of physical memory and total memory that the process occupies.
Time+: The total CPU time that is consumed after the process is started.
Command: The start command name of the process startup, and if this line does not appear, the process will have a full command line.
While the top command is in use, you can also use some interactive commands to complete the functionality of other parameters. These commands are started by using shortcut keys.
< space;: Refresh now.
P: Sort According to CPU usage size.
T: Sort by time, cumulative time.
Q: Exit the top command.
M: Toggles display memory information.
T: Toggles display of process and CPU status information.
C: Toggle display command name and full command line.
M: Sorts according to the size of the memory used.
W: Writes the current settings to the ~/.TOPRC file. This is the recommended way to write top configuration files.

Free
1. Role
The free command is used to display memory usage, and the use of permissions is for all users.

2. Format
free [-b-k-m] [-O] [-s delay] [-t] [-v]

3. Main parameters
-b-k-M: Displays memory usage in bytes (KB, MB), respectively.
-S delay: Displays the number of seconds per second to show memory usage.
-T: Displays the memory sum column.
-O: Do not display buffer throttling columns.

Uptime

18:59:15 up min, 2 users, load average:1.23, 1.32, 1.21
The time now
The time the system is running until now
Number of users connected
Last minute, five-minute and 15-minute system load
Parameter:-V displays version information.

Vmstat

procs-----------Memory-------------Swap-------io------System------CPU----
R b swpd free buff cache si so bi bo in CS US sy ID WA
0 1 24980 10792 8296 47316 5 19 205 52 1161 698 26 3 1 70
1 Observing disk activity
Disk activity is mainly learned from the following indicators:
BI: Represents the number of blocks read from disk per second (BLOCKS/S). The larger the number, the more activity that reads the disk.
Bo: Represents the number of blocks written to disk per second (BLOCKS/S). The larger the number, the more activity that is written to disk.
Wa:cpu the time scale to wait for disk I/O (pending disk IO). The larger the number, the more severe the file system activity is blocking the CPU, because the CPU is waiting for the slow disk system to provide data. WA is ideal for 0. If WA is often greater than 10, the file system may need to be tuned for performance.
2 Observing CPU Activity
Vmstat more than top to reflect CPU usage:
US: The percentage of time that the user program uses the CPU. The larger the number, the more busy the user process.
SY: The time scale at which the system calls to use the CPU. Note that NFS is running in the kernel, so the CPU time occupied by NFS activity is reflected in the SY. This number is often very large, you need to pay attention to whether a kernel process, such as NFS task is more onerous. If both us and Sy are relatively large, you need to consider separating some of the user programs from the other servers to avoid interaction.
ID:CPU the idle time ratio.
Wa:cpu the percentage of time to wait for pending disk IO.

Iostat

Used to count CPU usage and i/0 of TTY devices, hard drives, and CD-ROMs
Parameters:
-C Displays only CPU rows
-D Display Disk rows
-k displays disk output in kilobytes
-T includes timestamps in the output
-X includes extended disk metrics in the output

AVG-CPU:%user%nice%sys%iowait%idle
20.25 0.18 2.61) 76.39 0.57
%iowait percentage of CPU idle time waiting for local I/O
%idle percentage of CPU idle time without waiting for local I/O

Device:tps blk_read/s blk_wrtn/s Blk_read Blk_wrtn
HDA 9.86 284.34 84.48 685407 2036
The total number of transfers per second (TPs), 512 bytes per second (blk_read/s), 512 bytes per second (BLK_WRTN/S), and 512 bytes block reads (Blk_read) and writes (BLK_WRTN). 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 # Viewing the status of a mounted 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 status 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 # Lists all startup system services
program
# rpm-qa # View all installed Packages

commands for viewing system resource usage in CentOS

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.