Tmux to improve productivity

Sometimes I like to waste my free time with learning something new about the tools I use. If I have more time I like experimenting with tools I’ve never used before. This time I got to know an application called tmux and I want to show you why you should use it if you work using the terminal regularly.

Tmux is a terminal multiplexer which means that you can have several windows and panes in one screen. Mainly that’s it, but I’ll show you how useful it can be.

Before I used tmux, I always had several terminals running separately (several konsole applications to be more accurate, as I use KDE). There are several reasons why it is less effective than having only one screen.

Firstly and most importantly tmux will provide you a more stable layout of the terminal instances. During the work one thing that can improve your productivity is to make sure that you know exactly which terminal is responsible for the task you want to do next, and which command you should use to access it directly.

That is something you can try with several terminal screens too. You can say for example that you’ll have a terminal window on the left side for git, grepping stuff, system commands, etc. And one on the right side for editing source code. The problem is that OS windows are too flexible for that and you may end up using a lot of terminal screens which are in chaotic positions and you might search for the wanted screen with pushing Alt+Tab madly after you find the good one at last.

With tmux things getting much easier. The relative position of each panes are fixed (you can change it, but you probably won’t), and the windows can be named so it makes sure you won’t use it for something else. They can also be accessed easily, because the windows are identified with a number that can be used as a shortcut to get it in focus.

I’ll show you my current setup as an example:

  1. First window has two panes: one for gdb, one for looking around in code or in git history. This is a good combo, because most of the time I’d like to look at the code while debugging.
  2. The second window is for editing source code. There is only one pane where I run vim automatically on startup with LibreOffice root directory as current directory. I create panes in vim itself, because it allows me to copy-paste text between the buffers.
  3. Third is for building the code and to handle versions with git. I like separating this logic from poking around with git diff, git show, etc., because those commands come up in a different time for a different purpose. That’s why I don’t use all the git commands in the same window.
  4. It is for system commands only. As the windows have own history, it is a good way to easily access commonly used commands like “sudo pacman -S …” or alsamixer or whatever you tend to use.

That way (after some time of practice) I will always know I have to push Ctrl+a+2 to edit something, which is much faster than browsing in OS windows.

There are a lot of other benefits of using tmux. I only highlighted the one which was the most important for me.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s