Linux_CentOS memory, cpu, process, ports, hard disk management

Memory, Cup management top command

top

1 , Top first line of the command:

top - 15:31:47 up 9:30, 3 users, load average: 0.00, 0.02, 0.05

In turn corresponds to: the current system time up the system so far i the number of users running time, the current landing system, the Load Average three numbers represent the distance behind the now one minute, five minutes, fifteen minutes load .

2 , Top row of the second command:

Tasks: 133 total, 1 running, 132 sleeping, 0 stopped, 0 zombie

In turn corresponds to: Tasks represents task (process), 133 Total indicates that there are 133 of processes, in which there are running . 1 th, 132 th in sleep (suspend), stopped the number of states of the process is stopped i.e. 0 , Zombie state that is, the number of zombie processes is 0 Ge.

3 , Top third line of command, the CPU status:

% People (s): 0.2 us, 0.4 sy, 0.0 cm, 99.3 id, 0.0 times, 0.0 hi, 0.1 si, 0.0 st

Look at idle on it: the CPU idle rate of 99.3%

In turn corresponds to:
US: the User user space occupied by cpu percentage
sy: system kernel space occupied by cpu percentage
ni: niced changed the priority of the process takes cpu percentage of idle cpu percentage
wa: IO wait IO wait occupancy cpu percentage hi: Hardware IRQ hardware interrupt occupied by cpu percentage si: software soft interrupt occupied by cpu percentage
st: the hypervisor stolen time

4 , Top of the fourth line of command, memory status:

KiB Mem : 2897496 total, 1995628 free,191852 used,710016 buff/cache

Total memory : 2.76g Idle: 1995628/1024 / = 1.9 g of 1024, have been used 0.18g, 0.67g buffer memory

Buffer is specially set aside from the main memory and the memory used to store certain information, such as file table obtained from the disk, the program content being read

 

5 , Top command line seventh, monitor the processes of:

 

PID USER PR NI VIRT RES SHR S  %CPU %MEM  TIME+ COMMAND

 

In turn corresponds:
PID - the process of the above mentioned id
the USER - Process owner of
PR - priority process
the NI - Nice value. A negative value indicates a high priority, positive values indicate a low priority
VIRT - the total amount of virtual memory used by the process, units of kB . VIRT = SWAP + RES

RES -, not swapped out of physical memory size, unit process uses kB . The DATA CODE + = the RES
the SHR - shared memory size in kB
S - process status. D = uninterruptible sleep state R = running S = sleep T = trace / stop Z = zombie process % CPU - the last update to the current CPU time occupancy percentage
% MEM - percentage of physical memory used by the process
TIME + process uses - CPU Total time the unit 1/100 sec
the cOMMAND - process name (command name / command line)

 


Memory, Cup management uptime command

top - 15:31:47 up 9:30, 3 users, load average: 0.00, 0.02, 0.05

1.服务器工作时间
2.在线用户
3.平均负载 一分钟,五分钟,十五分钟的负载情况


看当前登录的账户 who、查看最新操作电脑的用户 last

who 命令:

  显示当前正在系统中的所有用户名字,使用终端设备号,注册时间。

whoami :

     显示出当前终端上使用的用户。

last:

  last 作用是显示近期用户或终端的登录情况

 


进程管理查看、杀死

1.查看进程

pstree 查看进程树 
pstree -ap 显示所有信息
pstree | grep httpd 
pstree -ap | grep httpd

 

ps -au
ps -au |grep httpd 
ps -aux

ps 中 aux 的含义:
显示现行终端机下的所有程序,包括其他用户的程序(a) 
以用户为主的格式来显示程序状况。 (x) 
显示所有程序,不以终端机来区分(u)

2、关闭进程

pkill httpd  //pkill 进程的名字
kill 2245   //kill 进程号
kill -9 1234  //kill -9 进程号 强制杀死

kill:执行 kill 命令,系统会发送一个 SIGTERM 信号给对应的程序。当程序接收到该 signal 信号后,将会发 生以下事情:
程序立刻停止

当程序释放相应资源后再停止

程序可能仍然继续运行

大部分程序接收到 SIGTERM 信号后,会先释放自己的资源,然后再停止。但是也有程序可能接收信号后, 做一些其他的事情(如果程序正在等待 IO,可能就不会立马做出响应,也就是说,SIGTERM 多半是会被阻塞的。

kill -9: kill -9 命令,系统给对应程序发送的信号是 SIGKILL,即 exitexit 信号不会被系统阻塞,所以 kill -9 能顺利杀掉进程。

 


查看端口

netstat -tunpl |grep httpd

 

  • -t --tcp 显示 TCP 传输协议的连线状况。
  • -u --udp 显示 UDP 传输协议的连线状况。
  •  -n --numeric 直接使用 IP 地址,而不通过域名服务器。
  •  -p --programs 显示正在使用 Socket 的程序识别码和程序名称。
  • -l or --listening display monitor servers in the Socket .

Turn off the firewall:

Firewalld Close: systemctl STOP firewalld 
SELinux closed: setenforce 0

 


View hard drive information

df command role is to list the entire file system disk space usage. Can be used to see how much disk space usage and has been there remains much space.

df 
df - H in a human-readable fashion show, with a total number of how many g g 
df / Home Usage view the folder where the disk

Guess you like

Origin www.cnblogs.com/loaderman/p/11596676.html