This is how I'm moving from GNU Screen to tmux, updated as I go. I run Arch Linux at home and on my servers, kUbuntu at work. My config. files are in my Dropbox (I'm moving over to ownCloud too, once I find a small CLI sync client) and symlinked, so I can have a consistent environment.
I don't consider myself a power user of the shell by any means, partly because I don't tend to concentrate on the shell itself too much and partly because it's less pain when I can't have it my way. I like my tools to be just enough to solve my problems.
As I did with Screen, I started with nothing and looked for a solution when I came across a problem. My first task was to start it without me having to do anything. I switched Konsole's default shell from Screen to tmux by copying ~/.kde4/apps/konsole/Screen.profile
to ~/.kde4/apps/konsole/tmux.profile
and changing the name and command lines in ~/.kde4/share/config/konsolerc
.
I used to have screen -AdR
,which would do a few things:
- start a new server and client if there isn't one to attach to (-R)
- detach other clients from the server (-d)
- resize the window to that of the new terminal (-A)
The equivalent command that I would use in Konsole's profile is:
tmux attach -d || tmux new
Next up, pretty things. My Screen status bar looked like this:
Screen >> Sammy >> (0* zsh) Thu 11/04/2013 19:30
Thankfully, the default of tmux is remarkably close:
[0] 0:zsh* "/home/seawolf" 19:30 11-Apr-13
How much the date being formatted in "%d-%b-%y" instead of "%d/%m/%Y" annoys me, we'll see.
Managing tabs (this is what I call it) acts and looks the same as far as I can tell, so nothing needed there. The only tweak I've made is the binding key (Ctrl-B), which I want as Ctrl-A. The Arch Wiki suggests Screen users can copy /usr/share/tmux/screen-keys.conf
to mimic it's key bindings, but I'd rather get used to tmux than spend six hours every day lying to myself. So, this went in my ~/.tmux.conf
:
unbind C-b
set -g prefix C-a
That reminds me: I hit Ctrl-A
a
far too often to switch to the last window. This tells me that I like doing it, and should continue to do so:
bind-key C-a last-window
I found out that tmux will name the window to the command being executed, a feature for which I had to have some preexec() magic in my .zshrc
for Screen -- out the window that goes, it never felt right anyway.