CH 8
CH 8
ps -u [username]
------------------------------------------------
ps -T
prints active processes that are executed from the terminal.
Linux: CHAPTER 8
Ps aux
You can use ps aux to get more in-depth information
about your running processes.
Ps lax
You can use ps lax to get more technical details but
may display faster by avoiding user name lookups.
----------------------------------------------------------------
Linux: CHAPTER 8
-------------------------------------------------------
Top –u username
Use top command with ‘u‘ option will display specific
User process details.
Linux: CHAPTER 8
CONTROLLING JOBS
What are jobs ?
In Linux or Unix, a job is defined as a task or command
that has started running but not yet finished what it
is doing.
As Linux and Unix are multitasking operating systems,
they allow you to run multiple commands simultaneously.
Each running command is called a job, and is assigned a
unique id called the job number.
It is very easy to manage jobs in Linux.
The main commands you use for job control in Linux are:
Terminate a job:
Ctrl+C (To terminate a forground process).
Kill
Linux: CHAPTER 8
KILLING PROCESS:
“Killing” a process just means “forcing the
process to quit.” This may be necessary if the
process is refusing to respond.
Commands:
kill
pkill
killall
Linux provides the kill, pkill, and killall
commands to allow you to do just that. These
commands can be used with any type of process,
graphical or command line, foreground or
background.
1- Kill command
Linux: CHAPTER 8
Examples:
ps aux | grep job
------------------------------------------------
kill 22978
Output: This command will terminate the job as
well as its process.
Linux: CHAPTER 8
------------------------------------------------
kill –SEGTERM 23070
Output: This command will terminate the job as
well as its process.
Linux: CHAPTER 8
killall control
Output: This command will terminate the job as
well as its process at once.
------------------------------------------------
kill -19 2834 or kill –SIGSTOP 2834
Output: This command will stopped the job but it
will remain in process.
Linux: CHAPTER 8
2- Pkill command
The pkill command allows you to kill a
process—or processes—by name. You do not
need to identify the process by PID.
pkill controll:
Use pkill to send a signal to one or more
processes which match selection criteria.
pkill –U username
Linux: CHAPTER 8
pstree command:
Use the pstree command to view a process
tree for the system or a single user. Use
the parent process’s PID to kill all
children they have created.
[root@host ~]# pstree –p username
[root@host ~]# pkill –p 8391
[root@host ~]# pgrep –l –u username