CentOS 7 to view and control processes

First, view the process
understand the process status of the system is a prerequisite for process management, using a different process status command to view from different angles.
1, ps command
ps command is the most commonly used Linux system, the process of viewing tools, mainly used to display a static snapshot contains complete information on the processes currently running. Through the different options, you can selectively view process information.
a: show all processes information in the current terminal, including those of other users
u: user-based process state
x: a generally used with this parameter, the current user terminal processes the information in all
-e: Display System All process information
-l: long format process information
-f: use the full format process information
to perform "ps aux" command. It will show the process information in the form of a simple list.
CentOS 7 to view and control processes
The first line lists the title meaning of each field of
CentOS 7 to view and control processes
the implementation of "ps -elf" command, the process will be long-format display system information, and contains richer content.
CentOS 7 to view and control processes
The first line lists the meaning of each field title
CentOS 7 to view and control processes

2, top command
top terminal command will display the current full-screen interactive interface process rankings, timely tracking CPU, memory and other system resources occupancy three seconds to refresh the default every time, its role is similar task windows system Manager.
CentOS 7 to view and control processes
Meaning top of each command line arguments
CentOS 7 to view and control processes
CentOS 7 to view and control processes

3, pgrep command
using the name of the process according to pgrep command, multi-attribute queries in a specific process of the user running the process, terminal and other processes where the PID number.
View all processes such as user fan is running.
CentOS 7 to view and control processes
pstree command
pstree output Linux system can command the tree structure of the various processes, more visually it determines the relationship between the processes.
CentOS 7 to view and control processes

Second, the control process
1, the boot process
in Linux system can be started manually by the user or start a new process in accordance with the schedule scheduling.
1), to start the process manually
process is generally divided into foreground process and background process, a process running in the foreground, the user must wait until the end of the process to carry out other operations, but when we execute a relatively long time to order, do not do the operation is inevitable that some waste of time then it is our turn to play a role in a background process, a process running in the background without waiting for its completion can operate other commands. Start running in the background need to add the final ampersand execute commands.
For example, we make copies of image files in Packages, and place it in the background.
CentOS 7 to view and control processes
2), operating mode change the course of
Ctrl + z: Suspend current process
jobs -l: Check background process
fg: recovery process
kill -9: End Process
CentOS 7 to view and control processes

Use the killall command to terminate the process
CentOS 7 to view and control processes

Use the pkill command to terminate the process
CentOS 7 to view and control processes
CentOS 7 to view and control processes

Guess you like

Origin blog.51cto.com/14449528/2432495