Reading Time: 3minutes
After my yesterday blog post explaining basis GNU screen use, I've decided to blog a bit more on the topic as I find terminal emulation to be quite interesting 🙂
Just like on on GNU / Linux, GNU Screen is available and installable via FreeBSD port – /usr/ports/sysutils/screen. Though screen is compatible with FreeBSD, it is not from scratch written to run on BSD architecture, but rather ported. Besides, that within the fild of terminal emulation, there are plenty of recent developments and feature richer programs available from install already. One of those I reference is tmux.. tmux's is superior to screen in that it is a re-writen terminal (from scratch) terminal emulator – multiplexer (as referenced in man tmux).
Another fundamental difference is it comes licensed under "less restrictive" BSD license (interesting fact is BSD has only 3 clauses), whether to GNU Screen applies GPLv 2 / 3 (4 freedoms clauses).
Tmux is presently existing for multiple architectures besides BSD including Linux and even as I check in its documentation has support for HP-HX and IRIX.
To install / use tmux on FreeBSD / NetBSD install port /usr/ports/sysutils/tmux with
freebsd# cd /usr/ports/sysutils/tmux
freebsd# make install clean
Installing mux on Debian GNU Linux is available straight from default package repositories, i.e. :
debian:~# apt-get install --yes mux
It is inteersting fact to mention, since OpenBSD 4.6 – Mr. Theo De Raddt and friends decided tmux to part of the base system! This means a lot since OpenBSD has always existed with the main ideology to be the most secure UNIX / BSD based OS around. This fact probably means from purely secure stand point tmux might be better choice than gnu screen
Another reason why tmux might be better alternative to Screen for BSD users besides security, is its configuration is much more simplistic whilst compared with Screen. If you have used screen, already you should surely know how complicated things are when it comes to configuration and screen (set) variables.
tmux's pre-defined command bindings are similar to SCREEN's, the difference is instead of Screen's:
CTRL + a + (letter)
key bindings are invoked with:
CTRL + b + (kbd letter)
People who already are acustomed to screen (like myself 🙂 ) would not be easy to re-learn use CTRL + b, thus it is helpful to revert default tmux CTRL + b to screen's CTRL + a.
$ echo 'set -g prefix C-a' >> ~/.tmux.conf
$ echo 'bind-key C-a last-window' >> ~/.tmux.conf
Moving over virtual windows in tmux just like in screen can be done using:
CTRL + a + 1 … 9
One has to be careful, as pressing CTRL + a should be done with a llittle delay before pressing the next letter, otherwise the command does not take affect.
Detaching emulated session, in tmux is done like in screen with pressing:
CTRL + a + (d [half a sec delay before pressing])
Attaching to latest detached tmux session is done with:
There are plenty of other stuff and applications but here I will not get in detail as it is all in man page.
tmux is great for BSD users, but for Linux users byobu is more interactive and user friendly (out of the box – with no need for extra configs)
Here are 2 screenshots from tmux website: