The Gluster Blog

Gluster blog stories provide high-level spotlights on our users all over the world

tmux > screen

Gluster
2013-10-25
Never “exit” again.

Why TMUX? 

Even developers, in todays climate, have to deal with multiple deployment scenarios and environments.  Some of use more than others — but in any case, every day, when I start work, I have to ssh into a VPN.  Then, i have to ssh into 2 or 3 servers to check on them.  I find myself creating new ssh terminals all day long and manually resizing them with my mouse.

And then when my ssh connection dies, i have to redo it all – and i lost my history 🙁

Rather than managing your terminals manually, its best to install tmux on a server thats always on.  At that point – you can simply ssh into the server and attach to your tmux session.  Since tmux multiplexes your terminal windows for you, you never have to worry about losing connectivity – if you do – all your work is still in place on your server , and to get back to it, you just ssh in and run tmux attach.

Why another post on TMUX?

Sometimes the simplest way to get started is to follow a recipe that gets you started… So do this, and even if your ssh connection dies, you will never again have to worry about losing your terminal histories and neatly organized layouts.

The image in this post is an image of what you should end up with : 3 windows, all on a server , that you can switch back and forth between using [ctrl – b] + arrow keys.

Do this:

First install it:

   
#Do something like this
su -c 'rpm -Uvh http://mirror.steadfast.net/epel/6/x86_64/epel-release-6-8.noarch.rpm'
yum install tmux

Now that its installed, create a new named session, and detach from it:

   
tmux new -s mysession
[ctrl + b] + d
tmux attach -t mysession

FYI, a great summary is here of commands to customize your layout : http://lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily . C+P Here for convenience:

 -   Ctrl+b " - split pane horizontally.
- Ctrl+b % - split pane vertically.
- Ctrl+b arrow key - switch pane.
- Hold Ctrl+b, don't release it and hold one of the arrow keys - resize pane.
- Ctrl+b c - (c)reate a new window.
- Ctrl+b n - move to the (n)ext window.
- Ctrl+b p - move to the (p)revious window.
 

So lets create some tabs now.

   
[ctrl + b] + % #this creates a tab on the right side for you
[ctrl + b] -> #this switches you into the right tab
[ctrl + b] " #this further splits the right tab into another vertical terminal 

And thats it !

Oh and dont forget this awesome trick that rearranges all your windows for you (hit it multiple times - and each time you get a different configuration).

[ctrl + b] <SPACE> #rearrange windows.  keep spacing till you get the desired arrangement.

BLOG

  • 06 Dec 2020
    Looking back at 2020 – with g...

    2020 has not been a year we would have been able to predict. With a worldwide pandemic and lives thrown out of gear, as we head into 2021, we are thankful that our community and project continued to receive new developers, users and make small gains. For that and a...

    Read more
  • 27 Apr 2020
    Update from the team

    It has been a while since we provided an update to the Gluster community. Across the world various nations, states and localities have put together sets of guidelines around shelter-in-place and quarantine. We request our community members to stay safe, to care for their loved ones, to continue to be...

    Read more
  • 03 Feb 2020
    Building a longer term focus for Gl...

    The initial rounds of conversation around the planning of content for release 8 has helped the project identify one key thing – the need to stagger out features and enhancements over multiple releases. Thus, while release 8 is unlikely to be feature heavy as previous releases, it will be the...

    Read more