Process view
ps aux
ps
isprocess status
, which means process status.
Parameter informationa
:all
displays the processes used, not only the processes started by the current useru
: Output process information in the format ofuser
x
: Display the processes under all terminals of the current user
returned messagesUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.2 44672 3864 ? Ss 1月15 0:02 /usr/lib/syste root 2 0.0 0.0 0 0 ? S 1月15 0:00 [kthreadd] root 4 0.0 0.0 0 0 ? S< 1月15 0:00 [kworker/0:0H]
USER
The user who started the processPID
Process ID%CPU
CPU share (%)%MEM
Memory occupancy rate (%)VSZ
virtual memory (swap space) occupied by 061e43a098cf09RSS
occupies the size of the resident memory (physical memory)TTY
process is running on which terminal,?
unknown or no terminal requiredSTAT
indicates process statusS
sleepR
runZ
Zombie<
high priorityN
low prioritys
parent process+
foreground process
START
Process start timeTIME
process take to executeCOMMAND
The command to start the processps ef
Parameter informatione
: Display information about all processes in the systemf
:full
display process information in full format
Display information
Basically similaraux
top
Display informationtop - 01:25:39 up 5:25, 4 users, load average: 0.03, 0.06, 0.07 Tasks: 101 total, 4 running, 97 sleeping, 0 stopped, 0 zombie %Cpu(s): 1.3 us, 1.7 sy, 0.0 ni, 97.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1882012 total, 404536 free, 199104 used, 1278372 buff/cache KiB Swap: 0 total, 0 free, 0 used. 1486184 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1056 root 20 0 51136 1112 772 R 0.7 0.1 2:33.37 rshim 1 root 20 0 44672 3864 2444 S 0.0 0.2 0:02.64 systemd
The first line, the task queue information, is the same as the result of the
uptime
System Time: 01:25:39
Running time: up 5:25
Currently logged in users: 4 users
Load balancing: load average: 0.03, 0.06, 0.07 The three numbers represent the load of 1 minute, 5 minutes and 15 minutes respectively
second line, task
Tasks: 101 total, 4 running, 97 sleeping, 0 stopped, 0 zombie total processes: 101 running: 4 sleeping: 97 stopped: 0 zombie processes: 0
The third line, the cpu share
%Cpu(s): 1.3 us, 1.7 sy, 0.0 ni, 97.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
- us - user space: 1.3%
- sy - Kernel space (sysctl): 1.7%
- ni - Processes whose priority has changed (nice): 0.0%
- id - idle cpu (idol): 97.0%
- wa - io wait (wait): 0.0%
- hi - Hard interrupt usage (Hardware IRQ): 0.0%
- si - Software Interrupts: 0.0%
The fourth line, the memory status
KiB Mem : 1882012 total, 404536 free, 199104 used, 1278372 buff/cache total memory = free memory + used memory + cached memory
The fifth line, swap swap partition information
KiB Swap: 0 total, 0 free, 0 used. 1486184 avail Mem
linux
order to improve the efficiency and speed of reading and writing, the file will be cached in memory, this is part of the cache memorycache memory
, even after the end of your program to run this memory will not be released, which leads to yourlinux
system After the program reads and writes files frequently, the available physical memory becomes less. When the physical memory becomes insufficient, it needs to release some space from the physical memory. This part of the released space information will be temporarily reserved in theswap
space. Wait until the program When this part of data is needed for operationSwap
partition to the memory, so when theSwap
used
changes frequently, it means that the physical memory of the system is not enough at this time.- The sixth line, the meaning of the field is basically similar
ps aux
top -p process pid can only see the process information
pid
- The sixth line, the meaning of the field is basically similar
process control
Process priority control
nice -n 10 XXX
:nice
xxx
process is started to set its priority to 10. The range of this value is (-20~19), the smaller the value, the higher the priority.renice -n -20 17265
: Thepid = 17265
priority of a process of re-setting-20
Process job control
./xxx.sh &
The process to be started, running in the background.jobs
can view the processes running in the background.[2]+ Running nice -n 10 ./minio server /data/minio.data/ &
fg 2
:fg
+jobs number brings the process to the foreground.
ctrl + z
: Change the process to stopped state.bg 2
:bg
+jobs number Run this program in the background.
Service Management Tools
service
andsystemctl
areLinux
manages services.service
actually goes to the/etc/init.d
directory to execute related programsservice redis start 等同于 /etc/init.d/redis start
service xxx start
Start serviceservice xxx stop
shutdown serviceservice xxx restart
restart serviceservice xxx status
View service statussystemctl
isLinux
latest initialize the systeminit
, the role is to improve the system's boot speed,systemctl
also compatibleservice
command thatsystemctl
also toinit.d
directory continue implementation of relevant procedures.systemctl start xxx
Start the servicesystemctl stop xxx
shutdown servicesystemctl restart xxx
restart servicesystemctl status xxx
View service statussystemctl reload xxx
reload servicesystemctl enable xxx
boot servicesystemctl disable xxx
Start and stop service
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。