Planning process and task management!

A relationship, procedures and processes
1, the program
-stored in the hard disk, CD-ROM medium executable code and data
• Static save code
2, process
-code program running in the CPU and memory
Dynamic code execution
· Father The child process: each process can create one or more processes

 

Second, the static view process statistics ps command (ps aux and ps -efl are used to view the process)

1, ps aux command
(1) Action: shows the process information in the form of a simple list
(2) Option Interpretation:
A: all processes information in the current terminal, including those of other users
u: user-based format using process information output
x: displays the current user process information in all terminals

2.ps-elf command
(1) action: the system displays process information in long format and contains more content
(2) Interpretation option:
-e: show all processes in the system information
-l: Use a long (long ) format to display process information

-f: Use complete (full) format to display process information

Example:

Example: Remove user process?

[root @ localhost ~] # w // w Where to write on behalf of a user is signed in
19:44:13 up 1:07, 3 the Users, the Load Average: 0.22, 0.07, 0.06
the USER LOGIN @ IDLE JCPU the FROM TTY PCPU the WHAT
root: 0 :?? xdm 1:19 0 18:38 0.34s / usr / libexec / GN
root PTS / 0 192.168.100.134 18:38 5.00s 0.77s 0.01sw
root PTS / 1 192.168.100.134 19:38 1:41 0.11 s 0.11s -bash

 [root@localhost ~]#fuser -k /dev/pts/1

[root@localhost ~]# w
19:50:29 up 1:13, 2 users, load average: 0.00, 0.06, 0.06
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root :0 :0 18:38 ?xdm? 1:24 0.34s /usr/libexec/gn
root pts/0 192.168.100.134 19:48 5.00s 0.06s 0.02s w

 3: Check the details of a process

(1) ps aux | grep "Process Name"

  (2) ps -efl | grep "Process Name"

 

Third, the dynamic top command to view process statistics
1, role: top command will be displayed in full-screen interactive terminal interface in the current process rankings, time tracking including CPU,
occupancy memory and other system resources, three seconds refresh By default, The default sort order CPU utilization.
2, common options:
-d: refreshed specified time interval, in seconds
-b: a batch processing mode, typically used in conjunction with -n
-n: Specifies the number of times to cycle

-u: Specifies the user name
-p: Specifies the process ID

4, common interactive command
P: Size sorted using a percentage (i.e., into the default for this sort) according to the CPU
M: sorted according resident memory size
T: sorted according to the accumulation time
k: terminate a process
q: Exit the program
r: re-arrange the priority of a process (-20 to 19)

 

 

Fourth, view the process information
1, pgrep command
(1) action: PID query information based on specific criteria
(2) common options:
the -l: displays the process name
-U: specify a specific user
-t: Specifies the terminal
(3) Example:

[root@localhost ~]# pgrep -l 'bash'
12862 bash


2, pstree command
(1) action: List processes information in a tree structure
(2) Common options:
-a: displays complete information
-u: list of usernames
-p: PID number corresponding to the list

 

Fifth, the process was started

1, manually start:
(1) Reception Start: user input commands directly execute the program

[root @ localhost ~] # dd if = / dev / zero of = / dev / sdb1 bs = 100 count = 1
records read into the 1 + 0
is recorded to write a 0 +
100 bytes (100 B) has replication, 0.00998756 seconds, 10.0 kB / sec

(2) Start Background: adding "&" symbol is the end of the command line

[root@localhost ~]# dd if=/dev/zero of=/root/file2 bs=1M count=1024 &
[2] 62794

Front and back (3) the process of scheduling
1> Ctrl + Z suspends the current process, that is transferred to the background and stop execution
2> jobs command to see the list of tasks in the background, add -l also shows the PID number
3> fg command background recovery process to the foreground, you can specify the job program number
4> bg command will pause the background processes running in the background adjusted

Run (4) to terminate the process
1> Ctrl + C interrupt command being executed
2> kill, killall command
kill PID to terminate a specified number of processes
killall terminates all processes used to specify the name of
the -9 option is used to force termination

Example:

[root@localhost ~]# [root@localhost ~]# dd if=/dev/zero of=/root/file2 bs=1M count=1024 &
[1] 13513

 

Guess you like

Origin www.cnblogs.com/cxm123123form/p/11329528.html