tmux is a terminal multiplexer, resembling screen and seemingly straight-forward to configure.
Now, those of you paying attention will know that I use wmii, a tiling window manager, and you may ask what the difference is between creating one big tmux window and laying out a couple of terminals in that, or letting wmii place those terminals beside each other itself.
The answer is that for most instances, wmii will be enough, but just a little while ago I discovered a killer feature (one which makes me wish that tmux was available at work), namely the abililty to perform:
(demonstrated here) which simply outputs whatever you type into one of the terminals, into all the other terminals in this tmux instance as well.
How is this useful? If you have a couple of servers, on which you need to execute the exact same command, you simply start tmux, create a terminal for each server (and log in to that server) and then ask tmux to synchronize the panes, and then you type in your commands.
(Yes, this could probably be easily solved with a bash for-loop as well, depending on the amount of commands and their complexity)
Stupid Shell Tricks
I’ve known about ^foo^bar for a while (i.e. you type
$ some-command wif a typo
and you then do
to have the shell replace the first instance of that typo with the correct spelling (hopefully ;D)
But, this is really only good for typos or when there is ONE instance to replace. ^foo^bar won’t replace EVERY foo with bar, only the first occurrance. Which is sometimes now what you wanted.
!!:gs/foo/bar which replaces ALL instances of foo in the previous command, with bar, and re-executes it. Thanks to http://blog.urfix.com/25-linux-commands/ for that.
I think I have touched upon this before, but here we go anyway: it is possible to export an environment variable called “LESS” and less will read this and determine any runtime special behaviour based on the contents of the variable.
I am currently trying out
export LESS='FiX' where F makes less exit if the contents are short enough to all fit on the screen, i is for case-insensitive search and X for stopping less from sending the termcap initialization and deinitialization strings.
This means that when less exits, it won’t clear the screen (which would be a bummer if using F and less:ing short files…)
A pretty interesting read about how one could “work in the cloud.” I would have chosen other hardware/software (except for vim of course) but to all his/her own, right?
This sounds as if it could be useful for making sure that your logs are really your real logs. Makes sense, right?
From the reptyr readme: reptyr is a utility for taking an existing running program and attaching it to a new terminal. Started a long-running process over ssh, but have to leave and don’t want to interrupt it? Just start a screen, use reptyr to grab it, and then kill the ssh session and head on home.
A pretty cool more-utils command, ifne, which continues execution of the rest of the command, iff data was coming into ifne’s stdin.