103.5 Create, monitor and kill processes Flashcards
What is the command that kills processes based on a name provided as an argument?
#killalll Example: #sudo killall httpd
How do you kill a process based on its name and not process ID, only matching the name and nothing else?
pkill -x
How do you kill a process based on its name and not process ID?
sudo pkill
How do you kill a process gracefully?
- Find the PID with pgrep or top
- Issue #sudo kill
(kill alone will use -15)
How do you kill a process ungracefully or forcibly?
Find the process ID #kill -9
What command will list all the Signals that can be passed on to the kill command?
kill -l
How are stale PID files created?
When a process is killed ungracefully with SIGKILL (9).
What is the difference between SIGTERM(15) and SIGKILL(9)?
KILL 15 kills a process gracefully (SIGTERM)
KILL 9 kills it suddenly and ungracefully (SIGKILL)
How do you kill a process within #top?
Determine the PID from the list
Press the K key
Enter the PID
What is PID 1 called? What are the other processes that emerge from it called?
PID 1 : parent process
PID X: child processes
What command is used to display a listing of jobs that are in the background?
jobs
How do you send a command to the background?
You type the command and add the symbol at the end.
Also you can type at the end.
What command do you use to bring a command that was running in the background to the foreground?
fg and the job id (from the #jobs -l command)
What is the command called that when preceding a command, the command receives a signal 1 (NOHUP) so that should a terminal window close, the process will still run as long as the login session is not terminated.
nohup
What happens if you log out from a session and have commands running in the background still?
The commands get cancelled.
How do you exit or close a detached tmux session?
exit
How do you re-attach to a currently running session open with tmux?
#tmux ls Get the session number #tmux attach-session -t session#
How do you see how many sessions you have running with tmux?
tmux ls
How do you see how many screen sessions you have running?
screen -ls
How do you detach from a running tmux session to an original session?
Ctrl+b d
What does the screen command do?
It is a terminal window manager that allows you to run commands in an isolated session.
How do you create a new shell (other than the screen command)?
tmux