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 |
Solaris Signals
Signal Name | Signal Number | Signal Description |
SIGHUP | 1 | Hangs up |
SIGINT | 2 | Interrupts |
SIGQUIT | 3 | Quits |
SIGILL | 4 | Illegal instruction |
SIGTRAP | 5 | Trace trap |
SIGABRT | 6 | Used by abort |
SIGEMT | 7 | EMT instruction |
SIGFPE | 8 | Floating-point exception |
SIGKILL | 9 | Kill (cannot be caught or ignored) |
SIGBUS | 10 | Bus error |
SIGSEGV | 11 | Segmentation violation |
SIGSYS | 12 | Bad argument to system call |
SIGPIPE | 13 | Writes on a pipe with no one to read it |
SIGALRM | 14 | Alarm clock |
SIGTERM | 15 | Software termination |
SIGUSR1 | 16 | User-defined signal 1 |
SIGUSR2 | 17 | User-defined signal 2 |
SIGCHLD | 18 | Child status change alias (POSIX) |
SIGPWR | 19 | Power-fail restart |
SIGWINCH | 20 | Window size change |
SIGURG | 21 | Urgent socket condition |
SIGPOLL /SIGIO | 22 | Pollable event occurred or Socket I/O possible |
SIGSTOP | 23 | Stop (cannot be caught or ignored) |
SIGTSTP | 24 | User stop requested from TTY |
SIGCONT | 25 | Stopped process has been continued |
SIGTTIN | 26 | Background TTY read attempted |
SIGTTOU | 27 | Background TTY write attempted |
SIGVTALRM | 28 | Virtual timer expired |
SIGPROF | 29 | Profiling timer expired |
SIGXCPU | 30 | Exceeded CPU limit |
SIGXFSZ | 31 | Exceeded file size limit |
SIGWAITING | 32 | Process' LWPs are blocked |
SIGLWP | 33 | Special signal used by thread library |
SIGFREEZE | 34 | Special signal used by CPR |
SIGTHAW | 35 | Special signal used by CPR |
SIGCANCEL | 36 | Thread cancellation signal used by libthread |
SIGLOST | 37 | Resource lost |
SIGRTMIN | 38 | Highest priority real-time signal |
SIGRTMAX | 45 | Lowest priority real-time signal |
0 comments:
Post a Comment