View, control process

Source: Internet
Author: User

Program: A static collection of executable code and data stored on an external storage medium, such as a hard disk

Process: A process is a computer program that runs in CPU and memory for dynamic execution, and can create multiple processes after each program starts

For example, the Web, where a large number of users concurrently access Yes, the HTTPD service creates multiple processes to provide services


1. View the process

(1.ps command: View static process statistics (processesstatistic)

A: Displays all processes under the current terminal, including processes for other users, combined with the X option to display the process information about the system

U: Output process information in a user-oriented format

X: Displays process information for all terminals of the current user

-E: Displays all process information in the system

-L: Display process information in long format

-F: Displaying process information using the full format

The above is the PS command commonly used options, some of the options are not with "-", may be inconsistent with the above, the habit of combining the above options such as: PS aux or ps-elf command


PS aux output command explanation

# PS aux

USER PID%cpu%MEM VSZ RSS TTY STAT START time COMMAND

Root 1 0.0 0.2 19232 1576? Ss 09:40 0:01/sbin/init

Root 2 0.0 0.0 0 0? S 09:40 0:00 [Kthreadd]


User: The name of the account that initiated the process

PID: The digital ID number of the process in the system, the only

%cpu: Percentage of CPU occupied

%MEM: Percentage of memory space consumed

VSZ: The size of the virtual memory (swap space)

RSS: The size of the physical memory consumed

TTY: Indicates that the process is running on that terminal.

STAT: Shows the current state of the process, S (Hibernate), R (Run), Z (Zombie),< (advanced first level), N (Low priority), s (parent process), + (foreground process). The process for a zombie state should be based on a manual termination.

Start: The time that the process was started.

Time: When the process was started

Command: Start the process by its name


If you execute the ps-elf command, all processes are displayed in a long format and contain richer content, for example, the output information also includes the Ppid column (the PID number that represents the parent process of the corresponding process)

Directly performing PS does not add any parameters, only the currently running process will be displayed

Because the number of processes that are displayed after the command is executed, you need to borrow the pipe character and grep to filter the displayed process, for example: viewing the bash process

ps-elf | grep bash


(2.top command: View process dynamic information

Top can dynamically view process information, CPU, memory and other system resources, by default, updated every three seconds, top similar to the Task Manager of Windows system.


Top command output explanation

System TasksInformation: Total process count, running number of processes running, number of processes sleeping dormant, number of processes terminated stopped, zombie zombie unresponsive process

CPU usage information: US, user occupancy, sy core occupancy, NI priority scheduling occupation, ID idle cpu;wa I/O waiting to occupy, hi hardware interrupt occupied, Si software interrupt occupied, St virtualization occupied, to understand idle CPU percentage, mainly see%id part.

Memory consumption information: Total memory space, used used memory, free memory, buffers buffer area

Swap space occupancy: ibid.


(3.pgrep command: query process information

Format:

pgrep [parameters] [process name]

-L Query Name

-U Query user

-T query processes running on a specific terminal


(4.pstree command: View the process tree

The Pstree command can output the tree structure of each process in the LIUX system

Format:

pstree [parameter] [user name/service name]

The-p option can be used to list the corresponding PID number at the same time

-U option to list the corresponding user name

-A option to list complete command information


2. Control process

(1. Manually start the process

The process can be divided into the foreground and the background run two, the foreground run needs to wait for the run to complete before running the next command, running in the background, you can directly run the next command.

How do I make the process run in the background? Add "&" at the back of the command, it's OK.

Example: Service vncserver Restart &


(2. Suspend the current process (into the background and stop execution)

CTRL + Z When the process is running, press CTRL + Z to stop the service execution and call into the background.


(3. View the process in the background

Jobs-l to view hidden processes


(4. Recovering a process running in the background


To be Continued ...








This article is from the "start from 0" blog, please be sure to keep this source http://0kaishi.blog.51cto.com/9457500/1678162

View, control process

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.