If You Are Constantly on SSH and Having to Run Long-Running Processes Then Use Tmux

Published: Nov 3, 2025

If you’re like me, always running ssh to connect to servers and having to run processes and wanting to know what you ran earlier in one combined session, run tmux. No backgrounding of commands, no using nohup, and even if the ssh session breaks, which most of the time it does if you’re running something that takes a long time, tmux is the best.

Running tmux is easy, just install and run tmux. However, we’re going to set up tmux such that it runs immediately after ssh. Here are the steps for FreeBSD 14.3.

# Auto-start tmux on login (SSH or console)
if (! $?TMUX) then
    if ( -x /usr/local/bin/tmux ) then
        tmux attach -t main >& /dev/null || tmux new -s main
    endif
endif

Note

tmux ls
tmux attach -t 0

🍇

Follow us: Prasna IT · LinkedIn · Facebook · Instagram

Previous Post
Next Post