centos 常用命令

将路径添加到系统路径下:

在/etc/profile 中添加:

vi /etc/profile
PATH=$PATH:/usr/xxx/xxx
export PATH

为使其立即生效:

source /etc/profile

查询cpu使用情况:

[fangying@localhost model_code]$ top -bn 1 -i -c
top - 20:31:41 up 28 days, 1:32, 7 users, load average: 6.23, 14.18, 17.73
Tasks: 576 total, 4 running, 533 sleeping, 39 stopped, 0 zombie
%Cpu(s): 30.9 us, 10.2 sy, 0.0 ni, 58.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 13190601+total, 2749668 free, 94492088 used, 34664260 buff/cache
KiB Swap: 16777212 total, 2392572 free, 14384640 used. 34933892 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
18446 fangying 20 0 22.7g 13.1g 13128 R 688.9 10.4 9318:18 /usr/bin/python3.5 -m ipykernel_launcher -f /run/user/1002/jupyter/kernel-+
26851 fangying 20 0 11.7g 4.2g 87536 S 288.9 3.4 68:03.78 python3.5 /GAna/meteorology/win/code/model_code/mp_win_pre.py 0 0 40
7214 fangying 20 0 13.8g 6.4g 87520 R 94.4 5.1 135:11.58 python3.5 mp_win_pre.py 1 40
13607 fangying 20 0 15.2g 6.4g 88760 R 94.4 5.1 637:54.73 /usr/bin/python3.5 -m ipykernel_launcher -f /run/user/1002/jupyter/kernel-+
17818 fangying 20 0 162400 2656 1600 R 16.7 0.0 0:00.05 top -bn 1 -i -c
4389 fangying 20 0 1588188 10012 2136 S 5.6 0.0 108:30.71 /usr/libexec/mate-settings-daemon
17820 fangying 20 0 218360 2944 2188 S 5.6 0.0 0:00.01 /usr/bin/pulseaudio --start --log-target=syslog
23657 root 20 0 873840 308976 7808 S 5.6 0.2 4:19.23 savscand --incident=unix://tmp/incident socketpair://43/44 --threads=5

%us:表示用户空间程序的cpu使用率(没有通过nice调度)

%sy:表示系统空间的cpu使用率,主要是内核程序。

%ni:表示用户空间且通过nice调度过的程序的cpu使用率。

%id:空闲cpu

%wa:cpu运行时在等待io的时间

%hi:cpu处理硬中断的数量

%si:cpu处理软中断的数量

%st:被虚拟机偷走的cpu

原文地址:https://www.cnblogs.com/echo-coding/p/9294049.html