What are Unix Linux Signals | Sigint Linux

What are Unix & Linux Signals

Signals In Linux

Linux Signals are a way of sending simple messages to processes. Most of these Messages are already defined and can be found in <linux/signal.h>. However, Linux signals can only be processed when the process is in user mode, it is dealt with immediately on returning to user mode.

Every signal has a unique signal name, an abbreviation that begins with SIG (SIGINT for interrupt signal, for example). Each signal name is a macro which stands for a positive integer – the signal number for that number for that kind of signal. Your programs should never make assumptions about the numeric code for a particular kind of signal, but rather refer to them always by the names defined. This is because the number for a given kind of signal can vary from system to system, but the meanings of the names are standardized and fairly uniform.

Signals can be generated by the process itself, or they can be sent from one process to another. A variety of signals can be generated or delivered, and they have many uses for programmers. ( To see a complete list of signals in the linux environment, uses the command kill –i.)

There are total 64 signals in Linux, the list of all the signal can be seen by

#kill –l

 

Few Important Linux Signals with its descriptions:

Linux Signals

The most common signals used are

  • 1 for reloading the process
  • 9 for killing the process
  • 15 for terminating the process
  • 20 for stopping the process

For kill the signal completely

To kill the signal

First find out the process running in the system, let’s say by a user

#ps –u <user name>

#ps –u  anil

#kill <signal no> <process id>

#kill -9 11591

 

Like you can use other signals to kiss the process like

#kill -15 <pid>

#kill -1 <pid>

 

To stop the process using a signal no. 20

To stop a process first login as a normal user and start a process

#su – Anil

#cat > hello

 

Check its pid and kill it by using 20,

#ps –u anil

#kill -20

 

Check its effect at the user’s console

 

Restart the process continue working

#fg <pid>

#fg 1

 

Leave a Reply

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