Ubuntu-Basic commands-14-Process Management

Source: Internet
Author: User
Tags pkill

14. Process Management

In MemoryProgram.
In Ram, there are programs and data, and programs cannot be written, except for viruses. Viruses can write programs and data can be read and written.
Programs are generally protected by the operating system.

View PS Process
Process tree pstree
Kill, pkill, and xkill. Kill can only be followed by the process ID, that is, PID. After pkill, follow the process name. After xkill, the window can be killed.
Dynamic View top
Background processes and processes are processes that do not interact with users. They are opposite to foreground processes. A virus is a background process. Run it silently. The pop-up advertisement of rogue software is the frontend process.
Back to the front-end FG process in the background can be transferred to the front-end.
You can transfer back the background BG process to the background.
Priority adjustment renice-20 ~~ + 19 priority. 0 indicates the normal priority, and + 20 indicates the lowest priority.

PS aux displays the details of all processes.
PS only displays processes of xuwei users.
Tty indicates that the terminal is.

User
PID process number
% CPU usage
% mem memory usage
vsz
RSS
tty location to terminal, auto enable to display? Manually enable the display to TTY, such as tty1.
stat status. s indicates sleep and sleep.
When does start.
CPU usage time
command
pstree process tree, which lists the relationships between processes. Process relationship diagram.

Enter the Firefox command in the terminal to open the Firefox browser. At this time, the terminal cannot process other tasks. We can open a terminal again and enter the command PS aux to view the process. We will find that there is a Firefox process recently
Xuwei 4175 12.0 2.3 190760 48204 pts/0 SL +/usr/lib/firefo
Xuwei 4183 8.2 2.9 125404 60964 pts/0 SL +/usr/lib/firefo
In this case, we can use the kill command to kill the Firefox process.
Enter the command kill 4175 and we will close Firefox to the process. We will find that the Firefox browser is closed. At this time, the first terminal will prompt terminated and allow other commands to run again.
We can also use the pkill command to kill the process.
For example, you can close the Firefox browser by entering the command pkill Firefox.

Xkill is used to kill a window. For example, if we enter xkill, the mouse cursor will change to X, and the window will be killed when we click it.

Run gcalctool to start the foreground process. At this time, the terminal cannot enter other commands. Press Ctrl + C to end the process. Foreground processes accept user interaction

Command: gcalctool & start the background process. At this time, the terminal can enter other commands. We cannot end the process by pressing CTRL + C. Background processes do not accept user interaction

Command: jobs to view background processes.
Run the FG command to call the background process back to the foreground.
For example, the command: FG 1. 1 is the serial number. after entering the jobs command, you can view

PS Al displays process information. The Ni column indicates the process priority.
command: sudo renice + 10-P 4196 indicates that the priority of a process whose process number is 4196 is set to 10.
result: 4196: Old priority 0, new priority 10
the priority of a process ranges from-20 ~~ + 19, because when we set the priority to be less than-20 or greater than + 19, it will be set to the minimum to-20 or the maximum to + 19 by default.

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.