kill process by name linux code example

Example 1: kill all processes by name linux

ps -ef | grep 'myProcessName' | grep -v grep | awk '{print $2}' | xargs -r kill -9

Example 2: kill process linux

#terminate process with SIGKILL signal by process id
kill -9 pid

Example 3: linux kill process

kill -9 3827

kill -9 3919

kill -9 10764

kill -9 11679

Example 4: how to kill process by command name

pkill firefox

Example 5: kill process by name

#on a cluster #sbatch process 
scancel -u username

Example 6: kill all process

killall node -9