Linux golden commands

Kill any process using port

USE THIS COMMAND ON YOUR OWN RISK !

sudo kill -9 $(sudo lsof -t -i:4200)

If you want to check that if process running than and than kill the process , use bellow one

if sudo lsof -t -i:4200; then sudo kill -9 $(sudo lsof -t -i:4200); fi

Above command will check that process is running than kill by process id.

Kill any process by it's process name

her I am killing htop process using bellow command.

sudo pkill htop 

sh: 1: cross-env: Permission denied npm ERR! code ELIFECYCLE

sudo chown -R $USER /usr/local

chmod -R a+x node_modules

Tags: linux

Related posts