Thursday, May 24, 2012

tmux, a Better Terminal Multiplexer than screen

Recently I encountered a program called tmux which claims to be better at "terminal multiplexing" than screen. I did not have any idea about "terminal multiplexing", but I had been using screen for quite a few years now. tmux promises to be better that screen according to the tmux sourceforge page. This got me interested.

I installed tmux, and have been using it since last 2 weeks. My experience has been great except for a minor hiccup between vi and tmux. I thought of writing a small tutorial, but I feel there are better and more detailed ones that I would have the patience to write; not to mention we all "stand on the shoulders of giants". So I am going to point you to the online resources:
Finally, tmux is quite good and it gives some features not in GNU screen. Unfortunately, tmux is not as popular as screen, so you should be able to use both. Here is my contribution to the community, a cheat sheet with popular commands for both tmux and screen together. Please note that I use Ctrl+a as my tmux hotkey rather than the default Ctrl+b. Here is the thing you have to add to your ~/.tmux.conf to achieve this:
unbind C-b
set-option -g prefix C-a
Copy-pasting in tmux is also quite easy. You can copy from any part of the command window. Go to the copy mode by Ctrl+a PageUp. Move around the terminal using arrow keys. Ctrl+Space to start marking the text from where you want to copy. Use arrow key to select text. Alt+w to copy the text. Paste text using Ctrl+a ].

Thanks for reading.

Wednesday, May 23, 2012

Reload .inputrc at runtime

If you have been playing around with bash for some time you must have changed the file .inputrc sometime. I have changed it several times mostly for Del key and auto-completion trick. However every time I change it I have to logout of bash for it to take effect. Here are two different ways to do the same without logging out of the shell.
  1. Keyboard shortcut : Ctrl+x followed by Ctrl+r
  2. Script : bind -f ~/.inputrc
Here is an excerpt from my .inputrc which many others might find useful:
"\e[1~": beginning-of-line          # home
"\e[3~": delete-char                # delete
"\e[4~": end-of-line                # end
"\e[5~": history-search-backward    # page-up
"\e[6~": history-search-forward     # page-down
Hope this helped you.