TMUX FTW

Jul 18, 2024 min read

I just spend a few minutes watching a video explaining the benefits of using TMUX, the terminal multiplexer. It was a video from NetworkChuck, you need to learn tmux RIGHT NOW!!!

I was able to set tmux as my default shell on both my desktop and server, then have tmux use fish as its default shell.

My desktop is running Aurora-DX and the server is running ucore-hci:stable-zfs. I setup Homebrew on uCore by running the install script, Aurora has it installed out of the box.

To get fish install via brew:

brew install fish

Thankfully tmux is installed on both systems out of the box as well. To get it to play nicely with my desktop’s clipboard on Wayland, I installed the Tmux Plugin Manager.

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

I created the ~/.tmux.conf files on my desktop and server.

Desktop:

set-option -g default-shell "/home/linuxbrew/.linuxbrew/bin/fish"

set -s set-clipboard on
set -s copy-command 'wl-copy -- '
set -g mouse on

# Send bind-key to remote session by `C-b b`
bind-key b send-prefix

setw -g mode-keys vi

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

Server:

set-option -g default-shell "/home/linuxbrew/.linuxbrew/bin/fish"
set -g mouse on

setw -g mode-keys vi

Lastly I set tmux as my default shell by executing it with .bashrc

🛑 Don’t do this right now. It caused my KDE Plasma to login to a black screen. I will look into a better way and update when I can.

Add the following line to the end of ~/.bashrc:

if [[ -z "$TMUX" ]]; then
    if tmux has-session 2>/dev/null; then
        exec tmux attach
    else
        exec tmux
    fi
fi

With all that done, I can now enjoy creating new panes, windows and not worry about commands being terminated do to disconnections. Using the bind-key b send-prefix, I am able to press Ctrl+b then b then the command I want to send to my server.

I am really starting to fully enjoy my computers lately. Thank you to all whom are working on the Universal Blue project, Linux kernel and all the other great F/LOSS out there. I really appreciate the opportunity to use it. God Bless you.