If you have a service running on your system on a certain port and you want to kill it using bash you can make use of the kill command, the kill command can send a signal to a process to terminate it,
Example:Say I have MySQL running on port 3306 or tomcat on 8080 and I want to kill it,
$ kill $(lsof -t -i:3306)
$ kill $(lsof -t -i:8080)
lsof: list open files
-t: to produce an output of lsof without headers with just the process identifier (PID)
Have Questions? Post them here!
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!