Using CheatSheets To Apply Best Practices

Linux Signal CheatSheet

Linux Signal CheatSheet

1.1 Basic

Name Command
Signal for interprocess communication A Kernel notify a process that some condition has occurred.
kill -l List all signals
Critical signals The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
SIGKILL, SIGTERM Send kill signal to a given process. kill -term $pid, kill -9 $pid
SIGHUP Reload or restart a process. kill -HUP $pid
SIGHUP Terminal warns dependent processes of logout
SIGINT Users wish to interrupt the process
SIGCHILD When a child process terminates, instruct OS to cleanup the resource
SIGSTOP Suspend a process
SIGALRM  
SIGUSR1, SIGUSR2 User defined signals
SIGSTOP vs SIGTSTP SIGSTOP can’t be ignored by the targetted process, but SIGTSTP can
What happens, when pressing Ctrl-C Kernal translates the ASCII character(^C) to SIGINT signal
Reference wikipedia: Signal (IPC)

1.2 Background & Daemons

Name Command
Suspend process: bring it to background kill -STOP $pid, Ctrl-z
Bring a background process to foreground fg $JOB_ID
List all background jobs jobs, jobs -l
Put a running process to background, and ignore HUP signal nohup $command &
nohup with redirection nohup $command>foo.out 2>foo.err < /dev/null &
Tools to bring process to background and detach signals nohup, tmux, screen

1.3 More Resources

License: Code is licensignal under MIT License.




Leave a Reply

Your email address will not be published. Required fields are marked *