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.
- Edit
~/.cshrc, add the following lines at the bottom of the file:
# 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
- Run a new ssh session and tmux should start automatically.
Note
- To get back to the last session, do:
tmux ls
- If you didn’t name your tmux session, then the default command would be:
tmux attach -t 0
🍇