Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I can forward local ports using the command below

ssh> help
      -L[bind_address:]port:host:hostport    Request local forward
      -R[bind_address:]port:host:hostport    Request remote forward
      -KR[bind_address:]port                 Cancel remote forward

ssh> -L 8080:localhost:8080
Forwarding port.

But how to cancel that port forward? I see the -KR for cancel remote forwards but there does not appear to be a -KL to cancel my local forward.

Asking for another forward on the same port (hoping to override the old one) gives this message

ssh> -L 8080:localhost:8081
bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 10101
share|improve this question

2 Answers 2

up vote 1 down vote accepted

There seems to be no way other than to exit the connection and start over. I'd love to be proven wrong...

share|improve this answer

There's no simple way to do it on the command-line.

You can find the PID:

$ ps x | grep ssh
 1234 ?        Ss     0:00 ssh -f -N -L 8080:localhost:8080 remotehost

And then kill the process:

$ kill 1234
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.