Linux Process Management

Source: Internet
Author: User

Linux Process Management

Linux Process Management is a function of the Linux kernel.

1. ps command: process state

SysV style:-is required for each option-
BSD style:-is not required for each option-

A: Show All terminal-related processes u: x: All terminal-independent processes-e: show all processes-F: Extra full format-l:

2. Process classification:

Terminal-related processes
Processes unrelated to the terminal

3. Process status:

D: uninterrupted sleep
R: running or ready
S: resumable sleep
T: Stop
Z: Zombie

<: High-priority process N: low-priority process +: foreground process group process l: multithreading process s: Session Process

4. pstree: displays the process tree.

5. pgrep: display processes in grep Style

6. pidof: displays the PID of the running program.

Pidof init
Pidof sshd

7. top:

M: sort by resident memory size
P: sort by CPU usage percentage
T: sort by accumulative time

L: whether to display the average load and start time t: whether to display information related to CPU status m: whether to Display memory information c: whether to display the complete command line information q: topk: terminate a process-d: Change the refresh delay duration-B: Display in batch mode-n #: display only in batch mode # batch

8. important signals:

1: SIGHUP: enables a process to repeat the configuration file without restarting and make the new configuration take effect;
2: SIGINT: Ctrl + c, terminate
9: SIGKILL: killing a process
15: SIGTERM: terminate a process (default signal)

Specify a signal:
Signal Number: kill-1
Signal name: kill-SIGKILL
Abbreviated signal name: kill-KILL

9. killall COMMAND: Kill all processes named COMMAND.

10. Adjust the nice value:

Adjust the nice value of the started process:
Renice NI PID
Specify nice value at startup:
Nice-n NI COMMAND

11. vmstat: Command for viewing system status

12. foreground-> background:

Ctrl + z
COMMAND &
Bg: Stop the job in the background to continue running.

Jobs: view all jobs in the background
Job is good, different from process number
+: Commands are used to operate jobs by default.
-: The command is used to set the job for the second default operation.
Fg: re-transfer the background job back to the foreground
Fg [[%] jobid], % in the middle can be omitted, but if it is used on the kill command, the % number cannot be omitted, it is assumed that the corresponding process is terminated by default, such:
Kill 2 indicates killing the process whose PID is 2, rather than killing the job whose job number is 2.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.