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!
- How to Assign Bash Command to Variable
- How to Kill a port using bash terminal command?
- Bash For Loop Example
- bash: netstat: command not found
- Bash getopts Command Example
- How to fix bash ping command not found error
- [Fix] bash: script.sh: /bin/bash^M: bad interpreter: No such file or directory
- [fix] bash: ssh: command not found
- Fix bash: script.sh: Permission denied Error
- bash: ls command to see list files in current directory all subdirectories
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- How to use Autocomplete and Autosuggestion in Shell Commands
- Bash Hello World! Script Tutorial
- Install Bash Completion on macOS
- bash get year 2021 calendar
- How to create new user account in Windows bash
- Bash command to wait for seconds
- Know Bash shell version command
- How to start or open a new bourne-again shell (bash) session on Windows using Command Line CMD
- How to check your IP using bash for Windows?
- Bash Script to prefix files with sequential numbers in a directory
- How to Compare Strings in Bash
- Command to Sort File In Reverse Order [Unix/Linux/macOS]
- How to know the current shell you are logged in?
- List all Username and User ID using Bash Command
- List all Username and User ID using Bash Command - Bash
- Remove Possible Data Loss Message from Microsoft Excel - Microsoft
- Outlook and Hotmail not working - email issue, message not delivered, send receive problem - Microsoft
- [fix] docker exec requires at least 2 arguments - Docker
- How to quit or exit SFTP Prompt on Terminal - Linux
- PowerShell ISE Alternative for Mac - Powershell
- How to get SharePoint Online user details from person or group column using REST API - SharePoint
- How to Restart Apple Silicon based Mac (M1/M2 Chip) in Safe Mode - MacOS