Send signal to process

Think of signals as a command, you send that to a program for different goals. Linux have multiple programs for this job such as kill, pkill and pgrep.

# List all signal names
$ kill -l

# Send a TERM signal to a process with 3447 pid
$ kill -s TERM 3447

How to find a process id(pid)?

You can find it using ‘pgrep’, for example to find the pid of surf browser:

$ pgrep surf

Note: if you have multiple instances of a program, you will get the pid of all of them.

How ‘kill’ command itself works?

The ‘signal’ is a concept in unix so you use it in your C programs, this ‘kill’ command is just a program that uses this feature. Check out the signal(7) man page for more info.

For example in Suckless surf browser you can reload the browser by sending SIGHUP signal.

$ kill -s SIGHUP $(pgrep surf)