This command will kill all the processes with a specific name :
kill `ps -ef | grep process-name-to-kill | grep -v grep | awk '{print $2}'`
References
kill Manpage
The command kill sends the specified signal to the specified process or process group. If no signal is specified, the TERM signal is sent. The TERM signal will kill processes which do not catch this signal. For other processes, it may be necessary to use the KILL (9) signal, since this signal cannot be caught.
Most modern shells have a builtin kill function, with a usage rather similar to that of the command described here. The ‘-a’ and ‘-p’ options, and the possibility to specify pids by command name is a local extension.
If sig is 0, then no signal is sent, but error checking is still performed.
Syntax kill [-s sigspec] [-n signum] [-sigspec] jobspec or pid kill -l [exit_status] kill -l [sigspec] Key -l List the signal names -s Send a specific signal -n Send a specific signal number
ps Manpage
ps – report a snapshot of the current processes.
Syntax ps option(s) ps [-L] Options -L List all the keyword options This version of ps accepts 3 kinds of option: -Unix98 options may be grouped and must be preceeded by a dash. BSD options may be grouped and must not be used with a dash. --GNU long options are preceeded by two dashes. Options of different types may be freely mixed. The PS_PERSONALITY environment variable provides more detailed control of ps behavior. The Options below are listed side-by-side (unless there are differences). Simple Process Selection: -A a select all processes (including those of other users) -a select all with a tty except session leaders -d select all, but omit session leaders -e select all processes g really all, even group leaders (does nothing w/o SunOS settings) -N negate selection r restrict output to running processes T select all processes on this terminal x select processes without controlling ttys --deselect negate selection Process Selection by List: -C select by command name -G select by RGID (supports names) -g select by session leader OR by group name --Group select by real group name or ID --group select by effective group name or ID -p p --pid select by process ID (PID) -s --sid select by session ID -t --tty select by terminal (tty) -u U select by effective user ID (supports names) -U select by RUID (supports names) --User select by real user name or ID --user select by effective user name or ID -123 implied --sid 123 implied --pid Output Format Control: -c Different scheduler info for -l option -f Full listing -j j Jobs format -l l Long format -O O Add the information associated with the space or comma separated list of keywords specified, after the process ID, in the default information display. -o o Display information associated with the space or comma separated list of keywords specified. --format user-defined format s display signal format u display user-oriented format v display virtual memory format X old Linux i386 register format -y do not show flags; show rss in place of addr Output Modifiers: C use raw CPU time for %CPU instead of decaying average c true command name e show environment after the command f ASCII-art process hierarchy (forest) -H show process hierarchy (forest) h do not print header lines (repeat header lines in BSD personality) -m m show all threads -n set namelist file n numeric output for WCHAN and USER N specify namelist file O sorting order (overloaded) S include some dead child process data (as a sum with the parent) -w w wide output --cols set screen width --columns set screen width --forest ASCII art process tree --html HTML escaped output --headers repeat header lines --no-headers print no header line at all --lines set screen height --nul unjustified output with NULs --null unjustified output with NULs --rows set screen height --sort specify sorting order --width set screen width --zero unjustified output with NULs Information: -V V print version L list all format specifiers --help print help message --info print debugging info --version print version
Syntax awk'Program' Input-File1 Input-File2 ... awk -f PROGRAM-FILE Input-File1 Input-File2 ... Key -F FS --field-separator FS Use FS for the input field separator (the value of the `FS' predefined variable). -f PROGRAM-FILE --file PROGRAM-FILE Read the awk program source from the file PROGRAM-FILE, instead of from the first command line argument. -mf NNN -mr NNN The `f' flag sets the maximum number of fields, and the `r' flag sets the maximum record size. These options are ignored by `gawk', since `gawk' has no predefined limits; they are only for compatibility with the Bell Labs research version of Unix awk. -v VAR=VAL --assign VAR=VAL Assign the variable VAR the value VAL before program execution begins. -W traditional -W compat --traditional --compat Use compatibility mode, in which `gawk' extensions are turned off. -W lint --lint Give warnings about dubious or non-portable awk constructs. -W lint-old --lint-old Warn about constructs that are not available in the original Version 7 Unix version of awk. -W posix --posix Use POSIX compatibility mode, in which `gawk' extensions are turned off and additional restrictions apply. -W re-interval --re-interval Allow interval expressions, in regexps. -W source=PROGRAM-TEXT --source PROGRAM-TEXT Use PROGRAM-TEXT as awk program source code. This option allows mixing command line source code with source code from files, and is particularly useful for mixing command line programs with library functions. -- Signal the end of options. This is useful to allow further arguments to the awk program itself to start with a `-'. This is mainly for consistency with POSIX argument parsing conventions. 'Program' A series of patterns and actions: see below Input-File If no Input-File is specified then awk applies the Program to "standard input", (piped output of some other command or the terminal. Typed input will continue until end-of-file (typing `Control-d')
Kill all the processes with a specific name