Posts

Showing posts with the label tmux

Managing linux shell sessions with tmux

If you run shell scripts for data analysis which have a long execution time on a server, you probably feel the frustration when your network connection drops out momentarily and terminates the job. Sure, we can use the 'nohup' command to force the command to proceed despite loss of connection, but this is not ideal when for example we are doing an interactive analysis or trying to fix issues in a large job. In those cases, I like to use tmux to save my session. It enables me to rejoin that analysis if I get interrupted with other work and continue working interactively later. Here I will give you a guide to use tmux to save server sessions and rejoin them later.  First check whether tmux is already installed on your server: tmux ls If tmux is installed it will list the current sessions. If it is not installed, then it will say something along the lines of "tmux cannot be found". If you need to install it, you can ask your sysadmin to run: sudo apt update...