killgo
Force-stop every process that has a connection on port 8080, which includes the Go service and any other program that uses that port
- Command:
/go/killgo - Category: System
- Required arguments: None
- Output: None (silent)
- Last updated: 2026-11-19
On this page: Overview · Quick start · Syntax · Output · Examples · Troubleshooting · Details · See also
Overview
/go/killgo is meant to stop a Go service that listens on port 8080, for example when it hangs. It finds the processes that use port 8080 and ends each of them with kill -9, which stops a program at once and gives it no chance to save its work.
The command does not check what a process is. It stops every process that has a network connection with port 8080 at either end. That includes:
- the program that listens on port 8080
- programs that are connected to a service on port 8080, for example web server workers that forward requests to it
- other connections on port 8080, over TCP or UDP, IPv4 or IPv6
It does not start the service again.
[!WARNING] If a web server or another important program uses port 8080, this command can stop it too. Look at what is using the port first. See Examples.
Quick start
# See what is using port 8080
ss -ltnp 'sport = :8080'
# Stop it
/go/killgo
Syntax
/go/killgo
The command has no arguments or options. Any arguments are logged and ignored.
It needs to run as root. Started by an ordinary user it silently does nothing, or stops only that user's own processes.
Output
The command prints nothing. You may see kill: errors, for example No such process.
The exit code is 0 in most cases.
Logging
Every run is appended to /var/log/go/killgo.log.
Examples
# Show which program listens on port 8080
ss -ltnp 'sport = :8080'
# Show everything that uses port 8080, which is what killgo will stop
lsof -i :8080
# Stop only the program that listens (a gentler way to do it by hand)
kill <pid>
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing happens | Nothing uses port 8080, or the command wasn't run as root. |
Check with lsof -i :8080, and run it as root. |
| Other services stopped too | They had a connection on port 8080, as a client or as the server. | Restart them, and see Notes for maintainers. |
| The Go service is still not running | The command only stops processes, and doesn't start anything. | Start the service the way you normally do. |
kill: (<pid>) - No such process |
A process with several connections is listed more than once. | Harmless. |
kill: (<pid>) - Operation not permitted |
The command wasn't run as root. |
Run it as root. |
| The port is used again at once | Something restarts the service automatically, for example systemd. |
Stop it through that mechanism, for example systemctl stop <unit>. |
| Data of the service is damaged or incomplete | kill -9 gives the program no chance to finish writing. |
Stop the service gently first, and use killgo only as a last resort. |
Details
What it does
- Logs the call.
- Runs
lsof -i :8080(withoutsudo) to see whether anything uses port 8080. If nothing is found, it stops. - Runs
sudo lsof -i :8080, takes the process ID of each line, and passes the IDs tokill -9. Thekillruns withoutsudo.
flowchart TD
A["killgo"] --> B{"Anything on port 8080?"}
B -- "No" --> C["Nothing happens"]
B -- "Yes" --> D["List all processes with a connection on port 8080"]
D --> E["kill -9 each one"]
Notes for maintainers
| Issue | Why it matters | Suggested fix |
|---|---|---|
lsof -i :8080 also matches processes connected to port 8080 |
Clients such as web server workers are stopped with the service. | List only the listener: lsof -t -iTCP:8080 -sTCP:LISTEN. |
kill -9 is used straight away |
The service can't clean up, and data can be lost. | Send TERM, wait a moment, and use KILL only for what is left. |
| The command doesn't check what the process is | Any program on port 8080 is stopped. | Match the owner or the program path of the Go service, or stop its systemd unit. |
The first lsof and the kill run without sudo |
As an ordinary user the command silently does nothing. | Re-run through sudo at the top, like most other commands. |
| A process with several connections gives several lines | The same ID is killed repeatedly, with errors. | Use lsof -t or sort -u. |
| No output and no result | You can't tell what was stopped. | Print the stopped processes. |
The port is fixed to 8080 |
Can't be used for another service. | Make it an argument. |
| The service isn't started again | Needs a separate step. | Offer a restart option. |
See also
| Command | Description |
|---|---|
installgo |
Install the Go programming language (Golang) |
httptop |
Display active HTTP requests in real time |
cpu |
Show the server's CPU load and its top CPU-consuming processes, and send an alert when one process uses most of the CPU |
mem |
Check the top ten memory-consuming commands or services |
top |
Show the top CPU-consuming processes and their parent command |
allow |
Open a port in your server's firewall |