CTF Arsenal
Boot2Root / Command Mistakes & Recovery

nc: Address already in use

1. Error or symptom

Starting a listener fails because the port is already bound.

2. Likely cause

A previous listener on that port is still running in another terminal/background.

3. How to verify

lsof -i :PORT or ss -ltnp | grep PORT.

4. Correct command

kill PID   # from lsof/ss output, then restart: nc -lvnp PORT

5. Recovery procedure

Kill the stale process or just pick a different port for the new listener.

6. How to avoid repeating it

Close listeners explicitly (Ctrl+C) instead of leaving terminals open across sessions.