skill – Send a Signal to the Selected Process to Freeze the Process

The skill command is a Linux command that is used to send a signal to a selected process to freeze it. This command is useful when a process is consuming too many resources, and you need to stop it temporarily to free up system resources.

Overview

The syntax for the skill command is as follows:

skill [options] [signal] process_name

The skill command can be used to send any signal to a process. However, the default signal is -STOP, which is used to freeze the process. To use a different signal, you need to specify it using the -SIGNAL option.

Here are some examples of how to use the skill command:

  • To freeze a process named firefox, use the following command:
    skill -STOP firefox
    
  • To send a SIGTERM signal to a process named httpd, use the following command:
    skill -SIGTERM httpd
    
  • To send a SIGKILL signal to a process named mysqld, use the following command:
    skill -SIGKILL mysqld
    

Options

The skill command has the following options:

Option Description
-n Display the process ID of the selected process without sending any signal.
-v Verbose mode. Display the process name and signal sent to the process.
-u Specify the user who owns the process.
-c Specify the command name of the process.
-w Wait for the process to terminate before returning.
-SIGNAL Specify the signal to be sent to the process.

Troubleshooting tips

  • If you get an error message saying that the process does not exist, make sure that you have entered the correct process name. You can use the ps command to list all running processes and their names.
  • If the process does not respond to the signal, you can try using a different signal. Some signals, such as SIGKILL, cannot be ignored by the process and will force it to terminate.

Notes

  • The skill command is similar to the kill command, but it provides more options for selecting the process to be killed.
  • The skill command requires root privileges to send signals to processes owned by other users.
  • The skill command can also be used to send signals to multiple processes at once by specifying multiple process names separated by spaces.