Hacker News new | ask | show | jobs
by mkup 3676 days ago
When I set up a new server, I always configure ~/.bash_profile as follows:

   if [ $TERM = "xterm" ]; then
     ( (tmux has-session -t remote && \
        tmux attach-session -t remote) || \
       (tmux new-session -s remote) ) && exit 0
     echo "tmux failed to start"
   fi
   if [ $TERM = "screen" ]; then
     clear
     cat /etc/motd
   fi
This way tmux gets executed serverside always when I login remotely (e.g. via PuTTY), so my logon session and all running programs are always protected against sudden connectivity breaks. Also I rebind Ctrl+B to Ctrl+A via ~/.tmux.conf.

Three keyboard combinations to remember for beginner: Ctrl+A C creates a new window, Ctrl+A D detaches, and Ctrl+A {digit} switches windows. I'm not a power user of tmux, just a few basic features is all I need, but they have changed my server administration habits dramatically.