If you have a service running on a port on your Ubuntu Linux Server and want to kill it, you can achieve it by using the kill command,
Step 1: Identify the service running and get its Process Id (PID)
Syntax: sudo lsof -I:{PORT}# sudo lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 2785 root 6u IPv4 39198 0t0 TCP *:89 (LISTEN)
nginx 2785 root 7u IPv6 39199 0t0 TCP *:80 (LISTEN)
As you can see I have made use of lsof command to see if I have my Nginx localhost server running on the device
Step 2: Kill the Service on the port using PID
Syntax: kill -9 {PID}kill -9 2785
Kill the service in one single line
sudo kill -9 $(sudo lsof -t -I:{PORT})
More Posts related to Ubuntu,
- Fix: Ubuntu (Linux) - bash: sudo: command not found error
- Quick steps to install Nginx on Ubuntu Linux
- Add new user in Ubuntu Linux using Terminal Command
- How to know current Ubuntu Linux version via terminal command
- How to stop/start/restart apache server using command [Ubuntu]
- Fix - sudo: systemctl: command not found
- How to install zsh shell on Ubuntu
- [Fix] Ubuntu E: Unable to locate package sudo error
- Quickly install Apache Server on Ubuntu Linux
- Install specific JRE on Ubuntu using apt
- Fix Ubuntu /bin/sh: 1: zsh: not found error
More Posts:
- How to add sleep in Powershell Script - Powershell
- [Solved] SharePoint Access Denied error editing Document Name - SharePoint
- Change Max and Min Value of Android Seekbar Programmatically - Android
- How to detect Operating System using Java code - Java
- SharePoint Designer Workflow error - Coercion Failed: Input cannot be null for this coercion - SharePoint
- Android Installation error: INSTALL_FAILED_OLDER_SDK on Device - Android
- Change CKEditor Table Properties default width - CKEditor
- W3 : character data is not allowed here html validation error - Html