
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})
Have Questions? Post them here!
- Install Oh My Zsh on Ubuntu Docker complete steps
- Installing Home-brew on Ubuntu
- Install Golang (Go) on Ubuntu
- Install specific JRE on Ubuntu using apt
- How to stop/start/restart apache server using command [Ubuntu]
- How to install zsh shell on Ubuntu
- Quick steps to install Nginx on Ubuntu Linux
- How to know current Ubuntu Linux version via terminal command
- Add new user in Ubuntu Linux using Terminal Command
- Fix Ubuntu /bin/sh: 1: zsh: not found error
- How to install Python on Ubuntu
- [Fix] Ubuntu E: Unable to locate package sudo error
- How to stop MongoDB Server running on Ubuntu
- Install postgres Client using apt-get command
- How to kill service running on a port on Ubuntu Linux
- [fix] openssl No such file or directory error C++
- Fix - sudo: systemctl: command not found
- Access Windows share folder in Ubuntu Device in Network
- Add or remove users from sudo group - Ubuntu
- Quickly install Apache Server on Ubuntu Linux
- Fix: Ubuntu (Linux) - bash: sudo: command not found error
- How to list all tables using Java JDBC - Java
- Installing and using unzip Command to unzip a zip file using Terminal - Linux
- Xcode 13 - unknown error compiling for iOS 15.0 but module has a minimum deployment target of iOS 15.2 - iOS
- How to check your installed version of Git - Git
- How to open terminal on Mac to run commands - MacOS
- Fix Microsoft Teams Admin Center error - The Security zone setting isn't configured correctly - Teams
- How to change Chrome Spell Check from UK English to US English - Chrome
- Fix: TypeError: can only concatenate str (not int) to str in Python - Python