About Blog Contact

I've Started Using tmux

Currently, I’ve been sshing a lot. All my files regarding my thesis project are on my school’s server, so I need to ssh into it and do my editings there. However, it is very frustrating everytime the ssh stream breaks and my files being edited by vim gets corrupted. Also, I hate to close all my files after a day’s work, and reopen them the next day.

Tmux solves both these problems perfectly! It supports detaching my editing sessions to the background, allowing me to gracefully exit ssh while keeping my work state. Also, it won’t hang if the ssh tunnel breaks, making it useful with my spotty connection. Here are a few tutorials and guides that I’d found to be useful:

I had no sudo access in my school server, so I installed tmux from source. However, a ncurses library (libtinfo.so.6) wasn’t installed, so copied the library from my laptop (both are x86_64, so its allright) and wrote a simple wrapper script:

#!/bin/bash
TMUX_PATH=/home/yibaimeng/software/tmux
export LD_LIBRARY_PATH=$TMUX_PATH:$LD_LIBRARY_PATH
# https://stackoverflow.com/questions/4824590/propagate-all-arguments-in-a-bash-shell-script/4824637
$TMUX_PATH/tmux_bin "$@"

I configured LD_LIBRARY_PATH so that tmux could find the required dynamic library. Also, note the method I used to pass all arguments to the real binary: the quotation marks are needed!