Port forwarding with ssh
- open a port to it on my local machine
ssh -N -L 5050:localhost:5000 cmslpc307.fnal.gov Can check which ports are in use with
lsof -iTCP -sTCP:LISTEN -P -n
That lists every port something is listening on, with the process and PID. The flags: -P keeps ports numeric (no :http aliasing), -n skips DNS so it's instant, -sTCP:LISTEN filters to listeners (drops the noise of established connections).
Check one specific port — the question you'll actually ask most ("is 5000 taken?"):
lsof -i :5000
Which ports to use?
"pick something for my app" zone is the 8000s and the 3000–9000 range generally — 8080, 8000, 8888, 5000, 3000 are all common dev defaults precisely because they're memorable and rarely conflict with system services.