The ps (i.e., process status)
command is used to provide information about the currently running processes, including their process identification numbers
(PIDs)
ps Options:
-e - Everything,
all process
-f - Full
format listing
-u (username)
- Display username’s process
-p (PID) - Display
information for PID
Common ps Command:
ps -e - Display all process
ps -ef - Display all process,Full
ps -eH - Display
a process tree
ps -e --forest
- Display a process tree
pstree - Display
process in tree format
ps -u (username)
- Display a user’s process
top - Interactive process viewer
ps
topBackground Process:
Unlike
with a foreground process, the shell
does not have to wait for a background process to end before it can run more
processes. Within the limit of the amount of memory available, you can enter
many background commands one after another
Background & Foreground Process:
command & - Start command in background
ctrl+z - Suspend
the foreground process
bg {num} - Background
a suspended process
fg {num} - Foreground
a background process
jobs - Lists
jobs
Sending Foreground Process to Background:
man ls
crtl+z
bg
List Background Process:
jobs
man ls &
Foreground a Background Process:
fg 1 (job id)
Kill a Running Process:
ctrl+c - Kill
a foreground process
kill -l - Display
a list of signal
kill [-sig] [pid]
- Send a signal to a process
ex:-
1. kill pid = kill -15 pid = kill -Term pid
2.
kill -9 pid (-9 for kill signal)
kill -9 2027
Background, Froeground & kill Process in Linux
Reviewed by vijay pratap singh
on
April 12, 2017
Rating:
No comments: