7 ms·
Having tmux sessions for each open task is a life-saver, especially in an environment where I do all my work on a remote server. Now I can close the laptop lid
by MH15 4y ago
Having tmux sessions for each open task is a life-saver, especially in an environment where I do all my work on a remote server. Now I can close the laptop lid and never lose work. Simply reopen the ssh connection and keep going.
- asdff 4y agoIts especially helpful for stuff where I haven't touched it in a while too. One alias and boom, I'm back in a session with a pane with my editor open, a pane with the log, a pane with some notes, and a pane with the shell displaying the last line of code I ran from when I was last working on this pet project over six months ago. Right where I left everything and I can jump back in as if I was working on it an hour ago.
- darkteflon 4y agoI have a separate VS Code window connected to a dev container for each project that stays open for days, weeks or months at a time. Does the tmux approach materially improve upon that setup? Genuinely curious if I’m missing out on something here.
- thepostman0 4y agoMaybe, you can SSH to GNU Screen and attach where you were, perhaps from your phone to just read. You could do the same with rdesktop to something x11, but you'd need more than a 256MB VM for that. If you have this running 24x365 then you'd spend more energy/money.
- throwbadubadu 4y agoTo all above: but machines reboot, also, not? Even our coorp Linuxes now succumb to ugly IT update reboot cycles, Cloud VMs even more ephemeral, and lets not even start with dev containers... One can script tmux sessions to some degree, but still loosing a lot of state (editor open ther, shell history here..).
- asdff 4y agoI hardly reboot a machine unless I am intending to, but there are plugins for tmux for this too. https://github.com/tmux-plugins/tmux-resurrect https://github.com/tmux-plugins/tmux-resurrect https://github.com/tmux-plugins/tmux-continuum https://github.com/tmux-plugins/tmux-continuum
- t-3 4y agoRebooting my dev boxes for security updates or kernel upgrades once every few months/year isn't a big deal, and I generally know when it's going down. The laptop is an ssh terminal/browser/doc reader only!
- visarga 4y agoMe too, that's why I don't care how old it is anymore.
- asdff 4y agoYou can end up pretty deep down the rabbit hole with tmux and configuring it in different ways. One thing you can do that you might not be able to do with your vscode set up is have a script, written in tmux commands, that generates a complicated windowing environment. I am not familiar with the capabilities of your setup though, since I don't use vscode. I would guess tmux is more comfortable than vscode for using it with just the keyboard too. There's a ton written on tmux as you can imagine by this point. This page seems pretty comprehensive on the advanced features including tmux scripting: https://github.com/tmux/tmux/wiki/Advanced-Use https://github.com/tmux/tmux/wiki/Advanced-Use
- totetsu 4y agoWhat was that stateless ssh alternative? Using that you don’t even have to reopen the connection, it just works again right away.
- mangamadaiyan 4y agomosh?
- simongray 4y agoEternal Terminal works better.
- dboreham 4y agoSame, but Windows desktops. Email and Slack only on the left most desktop.
- LinXitoW 4y agoDo you exclusively work on remote servers? I love tmux, but I have the issue that I also use it locally, and to my knowledge, you can't have local and remote sessions in one tmux daemon. So I either have to open tmux in tmux, or open it in a separate terminal window. You mentioned your editor on the remote server. Does everyone have their own account with their own settings on all remote servers? We're still at a point where everyone accesses servers via the one shared "root-ish" user.
- jjwhitney 4y ago(Random tmux user commenting here...) I always run tmux locally. If you want to connect from a different computer, just ssh in and then "tmux attach".
- MH15 4y agoMy workflow is SSH in and run tmux on the remote server. I don't do any work directly on my laptop.
- asdff 4y agoEveryone has their own account with their own home folder containing their dotfiles. There are shared project and scratch drives. I do all my work on this server, nothing is done locally other than ssh into the server. For what you are describing the best practice is a nested tmux session with tmux running locally and on the remote server. So you would open tmux locally, then in one of the windows or panes you ssh into your machine, then open tmux on that machine. This will require you to press the tmux prefix (ctrl+b or however you've set it) twice to do the commands on the remote tmux instance. However you can get around this with some configuration (1). 1. https://www.freecodecamp.org/news/tmux-in-practice-local-and-nested-remote-tmux-sessions-4f7ba5db8795/ https://www.freecodecamp.org/news/tmux-in-practice-local-and... I think certain certain terminal emulaters like iterm2 have tmux specific features that could also be helpful, but I don't use that software so I am not as familiar.