List & kill processes
2023-12-08List processes
Relatert: https://useful-snippets.netlify.app/posts/finne-prog-med-port/
All
sudo netstat -nlp | grep tcp
Sudo gives more info on process id & stuff
One specific port
sudo lsof -i:3000
sudo lsof -i:80
sudo lsof -i:443
sudo lsof -i:4173
Kill process
By name
killall -9 node
sudo killall -9 caddy
related: https://useful-snippets.netlify.app/posts/quit-caddy-process/
sudo killall -9 http-server
By PID
eg: tcp6 0 0 :::3000 :::* LISTEN 1686/node
__________________________________^^______
killall -9 1686
By port
eg: tcp6 0 0 :::3000 :::* LISTEN 1686/node
________________^^________________________
sudo killall $(lsof -t -i:3000)
Eller med
fuser -k 3000/tcp