Common explanations of process management under Linux

Source: Internet
Author: User

Common explanations of process management under Linux

1.init: The process number is 1, which is the main process for all processes

2.ps command: View process status command, static process state

A: All terminal-related processes

U: Details displayed by user name

x: All processes unrelated to the terminal

-E: All Processes

-L: Long format display

-F: Full output

-o: Custom format output

Common commands:

PS aux displays all processes and displays them in detail

PS aux | grep httpd filtering out HTTPD process related information

Ps-elf Show all processes and show them in detail

Ps-ef Show all processes and show them in detail


Ps-axo User,pid,comm,ni

[Email protected] sh]# Ps-axo User,pid,comm,ni

Warning:bad syntax, perhaps a bogus '-'? See/usr/share/doc/procps-3.2.7/faq

USER PID COMMAND NI

Root 1 init 0

Root 2 migration/0-

Root 3 ksoftirqd/0 19

Root 4 events/0-5


Process Status:

D: Non-disruptive sleeping uninterruptible sleep

R: Run or Ready Running

S: interruptible sleep interruptible sleeps

T: Stops stop

Z: Zombie Zombie

<: high-priority process

N: Low-priority process

+: Processes in the foreground process group

L: Multithreaded Process

S: Session process first Process


2.pstree: Displays the process tree on the current system

3.pgrep: Search process based on user name, etc.

Pgrep-u Root

4.pidof: According to the program name, find the ID number of its related process;

[Email protected] sh]# pidof httpd

1931 1850 1849 1848 1847 1846 1845

5.top command: Type in Windows Task Manager, default 5-second refresh by CPU size sort, real-time process status

M: Sort based on the size of the resident memory

P: Sort by CPU percent usage

T: Sort by cumulative time

L: Show average load and start time

T: whether to display process and CPU status related information

M: whether memory-related information is displayed

C: Whether to display full command line information

Q: Exit Top

K: Terminate a process


-D: Refers to the duration of the refresh, in seconds

Top-d 1

-B: All flip screen printing

Top-d 1-b

-N #: Turn several screens to print

Top-d 1-b-N 5


6. Interprocess communication (Ipc:inter process communication)

Format: Kill PID control or kill specified PID process number

Killall commannd control or kill a class of service processes, typically specifying the process name instead of the PID process number

Important signal: Kill-l Show All signals

1:sighup: Let a process without restarting, you can reread its configuration file, and let the new configuration information to take effect;

2:sigint:ctrl+c: Interrupts a process

9:sigkill: kills the specified process directly, regardless of the child process

15:sigterm: Terminates a process, but notifies the child process to kill first, as the default signal,

Specify a signal format:

Signal number : kill-1

Signal name : Kill-sigkill

Signal name shorthand : Kill-kill

6.1. Kill 12321 Processes directly

Kill-9 12321

6.2. Kill all httpd processes directly,

Killall-9 httpd

Note: Because the HTTPD service contains a lot of processes, if you kill the command, you will be killed many times, and Killall once

7. Adjust the nice value:

The priority of the 7.1.linux system is 0-139 priority, 0-99 of which are kernel-adjusted; 100-139 is user-controlled

7.2. The smaller the number, the higher the priority

7.3.nice Adjust priority value range 20 to 19, process default Nice value is 0,

To adjust the nice value of a process that has already started:

Renice NI PID

Specify a nice value at startup:

Nice-n NI COMMAND

8. Foreground job: Occupy command prompt

Background job: After startup, release the command prompt, and subsequent operations are completed in the background

Front-to-back switching:

CTRL + Z: Send the job at the front desk to the backstage

Command &: Let commands execute in the background

BG: Let the stop job in the background continue to run

Format: BG [[%]jobid]

Jobs: View all jobs in the background; [Job number, different from process number]

+: will be the default action of the job

-: The job that will be the second operation

FG: Back-office jobs to the foreground

Format: FG [[%]jobid]

Kill%jobid: Terminates a job, this% cannot be defaulted, otherwise conflicts with the process number

9.vmstat: System Status View command

Vmstat 1 refreshes per second

Vmstat 1 5 Refreshes once per second and displays only 5 rows

10.uptime: Display system running long and load


This article is from the "Xavier Willow" blog, please be sure to keep this source http://willow.blog.51cto.com/6574604/1767892

Common explanations of process management under Linux

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.