Make your VPS more friendly with tmux
To make development more enjoyable you should use at least these tools.
tmux – it will allow you to use multiple terminal console windows in one. No need for multiple putty windows and logins. It will also keep your process live even if you leave it running and close the connection. And when you get back to your VPS, you’ll have access to stdout too.
to install tmux use simple command depending on your OS
sudo apt-get install tmux
or if you’re on centOS like me
yum install tmux
after installation, run it by entering
tmux
it should look something like this:
now you can split that view and have multiple terminals in one or you can create a new window. I prefer creating new windows but sometimes it’s practical to have multiple terminals in one. And this is how you do it:
Split screen vertically:
(ctrl-b) + %
(just to clarify… press ctrl and b in same time and then %)
Split screen horizontally:
(ctrl-b) + "
now to navigate between panes you can use command key(ctrl-b) with arrow keys
(ctrl-b) + arrow [up/down/left/right]
or use (ctrl-b) + q + [pane number]
Now let’s say you made 3 panes but it’s too crowded and you want to move one of the panes to a separate window. First you would navigate to pane you want to move:
(ctrl-b) + :
and enter “break-pane”
see on the screenshot below how it looks like:
And there you go, you moved a pane to a separte window, now to move between windows use
(ctrl-b) + [window number, in this case 0 is your first window]
or use one of these commands (n – next, p – previous, w – window list selection)
(ctrl-b) + n
(ctrl-b) + p
(ctrl-b) + w
This should be enough to get you started.
Oh yeah, one important thing. You’ll notice that if you scroll up it won’t behave as you would expect. To scroll inside a pane or a window in tmux use:
(ctrl-b) + [
and to exit scrolling just press q
Now when we have tmux let’s install htop, it’s a nice thing to have and it can help you monitor your vps. I like to start my htop on every vps on window 0 so switch there if you like and install htop:
yum install htop
or
apt-get install htop
if you can’t install it like that you’re probably missing repositories, in that case add repos and run above commands again (here’s one how-to in case if you’re having problems with older OS versions )now write htop and see what happens.
Once you get hooked on tmux it will be almost impossible not to use it anymore.
If you know anything else that can help or speed up development, write it in comments. I might try it and add it to this article.
Thanks for reading.