4 ms·
Alternatively, you could keep a tmux session open on the server and just attach it on connect. That way you can have everything arranged just the way you left i
by spindritf 13y ago
Alternatively, you could keep a tmux session open on the server and just attach it on connect. That way you can have everything arranged just the way you left it on disconnect. Same applications running, multiple windows, splits, etc. And you don't even need to start a new shell on connect.
ssh user@host -t tmux attach
You can add an alias for it.
alias backtowork='ssh -t user@host tmux attach -t worksession'
The last argument allows you to attach a chosen session if you have more than one running.
- ChristianBundy 13y agoAwesome, I hadn't though of that. My terminal automatically logs into my server via SSH and I just use my tmux aliases from there (minus the SSH, of course), but that would be a great way to do it if I developed locally. Thanks for the tip!
- GrinningFool 13y agoHm, why only for developing locally? The benefit of tmux/screen is that you can run it remotely, and reconnect to your session-in-progress at any time.
- dpacmittal 13y agoI use screen and it works well. The first thought when I saw this post was of screen and tmux. Anyone spending any kind of serious time in remote server through ssh should use screen/tmux.
- teh_klev 13y agoI totally agree, a lot more of my work life is spent on our Linux platform. tmux is a godsend due to my sometimes flaky VPN connection.
- martinp 13y agoI do something similar. Instead of passing the tmux attach command to ssh, I attach (or create) a tmux session if the shell is a) a login shell and b) started in a SSH session. [0] [0] https://github.com/martinp/dotfiles/blob/master/dot.zlogin https://github.com/martinp/dotfiles/blob/master/dot.zlogin
- adwf 13y agoI use Byobu on top of that for some extra useful features. http://byobu.co/about.html http://byobu.co/about.html
- ChristianBundy 13y agoI've looked through the docs and a video on YouTube and I still can't figure it out – what features does this offer that can't already be done with tmux?
- adwf 13y agoThere are two major things for me: The first is the easy attachment to existing tmux sessions, ie. I just ssh to a server and it'll re-attach to my last tmux session automatically - F6 then detaches cleanly and logs out. The next is all the handy notifications in the bottom bar; a bit like conky, if you use that. So it lists the server mem/cpu/network load, number of packages that need updating, RAID status, AWS estimated cost (if relevant), no. logged in users, etc... It originally started out with a Screen backend, then switched over to Tmux which has a lot of the same multiplexing functionality. So that's probably why you're not seeing a huge added benefit. But the added extras are enough to make me always want Byobu installed - particularly the easy session attachment.