Hacker News new | ask | show | jobs
by zamadatix 1029 days ago
For forwarding I almost never do -f. It can be a footgun in making it hard to tell which forwards are still open or operational.

-t is a cool trick, didn't know about that one.

An important note that's easy to overlook in the ~ escape command list is you can nest the escape when in nested sessions (i.e. if you're not using -J for whatever reason).

Cool list, it definitely lines up with what I've found useful and had a few more.

2 comments

-t is great, I use

$ ssh -t my-dev-vps 'tmux new-session -A -s main'

So each time I run it I'm right back where I left off.

Sometimes you have to use it twice if you're doing some (can't remember) bonkers stuff. I used to run commands on thousands of machines using a silly script I wrote.
> For forwarding I almost never do -f. It can be a footgun in making it hard to tell which forwards are still open or operational.

That kinda still is a problem when you have multiple shells open to the target server. I wish SSH exported it in any reasonable way aside from trying to get it myself from the process list...

If you avoid -f you can also chain commands knowing the second will only be run when ssh is finished running. Something I do often:

  ssh host.example -N -D 1080 && wall "Socks proxy to host.example closed."
The second command can be as complex as you want but a message in all terminals usually does the job for me.