Linux System Management-process management

Source: Internet
Author: User

  Process Management

Process: Program instructions running in CPU and memory are code that executes dynamically

Parent/Child process: a process can create one or more child processes

PID: ID number of the process

PPID: Parent Process ID Number

Linux consists of the following three processes:

    1. Interactive process: a process initiated by a shell. The interactive process can be run either in the foreground or in the background.
    2. Batch process: This process is not associated with a terminal and is a sequence of processes.
    3. Daemon: A process that starts when the Linux system starts and runs in the background.

Command 1: View the number of processes Pstree

Format: pstree [options] [PID or user name]

Option:-A displays the full command line

-U lists the owning of the process

-p lists the PID of the process

Common format: PSTREE-AP [pid or user name]

      

Command 2: View process snapshot PS

Format: PS [options]

Common options: Aux lists running processes (most detailed information)

-elf list running processes (PID and ppid are listed)

  

  

Status of the process in which the Stat column is represented

Status of R running

S is dormant and is awakened when needed

D non-disruptive hibernation, usually in the event of waiting for I/O

T Stop State

Z Zombie Status

Command 3: Process dynamic ranking Tool top

Format: Top [-D refresh interval (default 3 seconds)] [-u user Name]

  

Entering the top command in the command-line environment enters the interactive mode of the top command, with the following common commands:

P,m descending order according to%cpu,%mem

T is in descending order based on the time consumed by the process

K Killer the process of the specified PID

Q exit

Records the average load of Linux for one minute, five minutes, and 15 minutes

Command 4: Retrieve process information Command pgrep

Format: pgrep [options] [query criteria]

Option:-L output process name and PID

      

-U retrieves the process for the specified user

-T retrieves the specified terminal process

front and back scheduling of processes

Reception start: 1, enter the normal command line. 2. Occupy Terminal during Operation

Background start: 1, add the "&" symbol at the end of the command line. 2, the operation period does not occupy the terminal

Suspend current task (go to background and pause run): Shortcut key ctrl + Z

Terminate current task: Ctrl + C

View the background Tasks list: Jobs jobs-l [List pid of background tasks]

Restore a background task to the foreground run: FG FG [Task number]

Activating background suspended tasks: BG BG [Task number]

When a task ordinal is not specified, the default is the most recent background task

  Close process

  Kill process According to PID: Kill PID (Terminate process) kill-9 PID (Force end process)

Kill process by Process name: Killall [process name] (terminate process)

    

Linux System Management-process management

Related Article

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.