kill server code example

Example 1: rails kill server

kill -9 $(lsof -i tcp:3000 -t)

Example 2: kill app at port

#To list any process listening to the port 8080:
lsof -i:8080

#To kill any process listening to the port 8080:
kill $(lsof -t -i:8080)

#or more violently:
kill -9 $(lsof -t -i:8080)

Example 3: kill rails

lsof -wni tcp:3000
kill -9 PID

Example 4: kill port

kill -9 $(lsof -t -i tcp:8080)

Example 5: how to kill server

sudo lsof -iTCP:8080 -sTCP:LISTEN

Example 6: kill process unix

Find PID of process to kill with:
ps ax
Then just specify "kill PID" command as for example:
kill 16320
kill -9 16320 	#Force kill in case process is not answering.