Thứ Sáu, 9 tháng 11, 2012

Ubuntu Linux Stop a Process

How do I stop a process under Ubuntu Linux using command line and GUI tools?

You can use the following tools to stop a process under Ubuntu Linux:
  1. System Monitor application - A gui tools displays current active processes. it also provides detailed information about individual processes, and enables you to control active processes i.e. kill or end process.
  2. kill command - Send signal to a process such as kill or end a process.
  3. pkill command - Find processes or processes based on name and send end or kill singles to processes.
  4. killall command - Kill processes (including all its children) by name.

Gnome: System Monitor Application To Kill a Process

To start System Monitor GUI, click on System menu > Select Administration > System Monitor. Alternatively, open a command-line terminal (select Applications > Accessories > Terminal), and then type:
$ gnome-system-monitor
Click on Processes Tab:

Fig.01: A list of process and end Process button

How Do I End a Process?

  • First select the process that you want to end.
  • Click on the End Process button. You will get a confirmation alert. Click on "End Process" button to confirm that you want to kill the process.
  • This is the simplest way way to stop (end) a process.

kill Command Line Option

You can use the kill command to send a signal to each process specified by a process identifier (PID). The default signal is SIGTERM (15). See the list of common UNIX / Linux signal names and numbers for more information. In this example, ps command is used to find out all running processes in the system:
$ ps aux | grep firefox
To end a process, enter:
$ kill -s 15 PID-HERE
$ kill -s 15 2358

OR send signal 9 (SIGKILL) which is used for forced termination to PID # 3553:
$ kill -9 PID-HERE
$ kill -9 3553

See our previous FAQ "how to kill a process in Linux" for more information.

pkill Command Line Option

The pkill command allows you to kill process by its name, user name, group name, terminal, UID, EUID, and GID. In this example, kill firefox process using pkill command for user vivek as follows:
$ pkill -9 -u vivek firefox

killall Command Line Option

The killall command sends a signal to all processes. To terminate all httpd process (child and parent), enter:
$ sudo killall -9 httpd

OR
$ sudo killall -9 apache2
See sending signal to Processes wiki article for more information.

Không có nhận xét nào:

Đăng nhận xét

Học lập trình web căn bản với PHP

Bài 1: Các kiến thức căn bản Part 1:  https://jimmyvan88.blogspot.com/2012/05/can-ban-lap-trinh-web-voi-php-bai-1-cac.html Part 2:  https://...