How can I close an ssh tunnel?

Find the ssh tunnel's process id running on a specific port:

ps aux | grep <port number>

and kill the process:

kill -9 <process id>


You can kill the ssh process like others with

kill -9 $PID

You can find ssh session process ID with

pgrep ssh