The nicest way of leaving your code working remotely using TMUX

TMUX is tha maaaaan! Sure as death that you are going to love this! Remember when you ran a scan on a remote VPS? every time that you left it working it got the broken pipe, so you lost the session and you don’t get the results you wanted till the end of the code.

But with TMUX, you can leave running many SSH “sessions/terminals” working many processes. You can leave scrapers, scanners, crawlers, and even an app working on nginx/apache. Its like using all the process of your VPS and not losing any single fucking penny!

Its something like this:

So let’s get physical now, for having tmux, of course you need to have linux on any provider you want, it can be 512 MB RAM, $5 USD on Digitalocean. Then once you have it, connect via SSH on the terminal like: ssh root@ip.

Once you are in, make sure you have tmux installed:

sudo apt-get install tmux

Then, to open make sure to type tmux on the terminal and it will open.

So basic navigation on the tmux would be this by default:

  • Ctrl-b c Create new window
  • Ctrl-b d Detach current client
  • Ctrl-b l Move to previously selected window
  • Ctrl-b n Move to the next window
  • Ctrl-b p Move to the previous window
  • Ctrl-b & Kill the current window
  • Ctrl-b , Rename the current window
  • Ctrl-b % Split the current window into two panes
  • Ctrl-b q Show pane numbers (used to switch between panes)
  • Ctrl-b o Switch to the next pane
  • Ctrl-b ? List all keybindings

The trick here is that you can have as many SSH windows you want doing Ctrl-b c and then running other process that you can navigate with Ctrl-b n and Ctrl-b p (from next, previous) , else you can have your window split if you do Ctrl-b % and you can watch all in panels.

IMPORTANT: If you want to exit TMUX and leave the session working with the scripts you ran, you have to do CTRL-B D which means it will detach.

Then afterwards, when you come back from your procrastination you can go and type:

tmux attach

Which will make you restore your tmux session that you left working with other processes.

Then when you come back to your session, you will see everything is finished or keep running extracting more data

tmux1

So now you know how to take the most of what you pay for the VPS, hope you like it and leave the love dudes ;).

Here is a good vid that explains deeply more about tmux:

Leave a Reply