ps -ef | grep <process name>
kill <process id>
kill –9 <process id>
Example id=1234
kill 1234
kill –9 1234 # SIGKILL
Kill Process Mass Process Example
ps -ef | grep <process name>| awk '{print $2}' | xargs kill -9
Example ftp process
ps -ef | grep ftp | awk '{print $2}' | xargs kill -9
Handling Signals
Each Unix signal has a default set of effects on a Unix program. Programmers can code their applications to respond in customized ways to most signals. These custom pieces of code are called signal handlers.
Two signals are unable to be redefined by a signal handler. SIGKILL always stops a process and SIGSTOP always moves a process from the foreground to the background. These two signals cannot be "caught" by a signal handler.
FreeBSD Signals
Signal Name | Signal Number | Signal Description |
SIGHUP | 1 | Terminal line hangup |
SIGINT | 2 | Interrupt program |
SIGQUIT | 3 | Quit program |
SIGILL | 4 | Illegal instruction |
SIGTRAP | 5 | Trace trap |
SIGABRT | 6 | Abort |
SIGEMT | 7 | Emulate instruction executed |
SIGFPE | 8 | Floating-point exception |
SIGKILL | 9 | Kill program |
SIGBUS | 10 | Bus error |
SIGSEGV | 11 | Segmentation violation |
SIGSYS | 12 | Bad argument to system call |
SIGPIPE | 13 | Write on a pipe with no one to read it |
SIGALRM | 14 | Real-time timer expired |
SIGTERM | 15 | Software termination signal |
SIGURG | 16 | Urgent condition on I/O channel |
SIGSTOP | 17 | Stop signal not from terminal |
SIGTSTP | 18 | Stop signal from terminal |
SIGCONT | 19 | A stopped process is being continued |
SIGCHLD | 20 | Notification to parent on child stop or exit |
SIGTTIN | 21 | Read on terminal by background process |
SIGTTOU | 22 | Write to terminal by background process |
SIGIO | 23 | I/O possible on a descriptor |
SIGXCPU | 24 | CPU time limit exceeded |
SIGXFSZ | 25 | File-size limit exceeded |
SIGVTALRM | 26 | Virtual timer expired |
SIGPROF | 27 | Profiling timer expired |
SIGWINCH | 28 | Window size changed |
SIGINFO | 29 | Information request |
SIGUSR1 | 30 | User-defined signal 1 |
SIGUSR2 | 31 | User-defined signal 2 |
SIGTHR | 32 | Thread interrupt |