Linux "Address Already in Use" — Port Conflict Fix
Warninglinux network
Overview
Fix "Address already in use" or "EADDRINUSE" error. Another process is using the port.
Key Details
- Error: Address already in use (EADDRINUSE)
- Category: Linux Network Error
- Port is occupied by another process
- Service cannot start on desired port
Common Causes
- Another instance of the service is running
- Previous process did not release the port
- Different service using the same port
- TIME_WAIT state holding the port
Steps
- 1Find what is using the port: sudo lsof -i :PORT
- 2or: sudo ss -tlnp | grep PORT
- 3Kill the process: sudo kill PID
- 4Use SO_REUSEADDR in code for TIME_WAIT
- 5Change to a different port if needed
Tags
linuxlinux-networklinux port already in useubuntuterminal
More in Linux Network
Frequently Asked Questions
Typically 60 seconds. Use SO_REUSEADDR to bind immediately.