Basics of tmux
Running Large Language Models (LLMs) locally and fine-tuning LLMs on a personal computer is a bit challenging. I am using the MacBook Air M4 16/256 GB (base variant). On this spec, I tried to run Ollama and LM Studio; the download and install process went smoothly, but when I tried to download and load open-source models, they barely ran. This pulled all the available storage on my RAM and froze my laptop; on top of this, my laptop heated up too much. For this reason, I was exploring some techniques to get my work done. Luckily, my university provides free servers to its students. I set up authentication, VPN, and remote SSH to connect to the server, and every process was going great. When I was using VS Code with remote SSH, I noticed a weird thing: whenever my laptop screen went off because of inactivity, the server connection broke. Again, I needed to re-run every process I had done before. In some heavy model training, models take hours or days to train, and then I was exploring alternatives to solve this issue. Today I found tmux, where we can run every process in a tmux session; tmux keeps the session active in the background even if I turn off my Mac, which turns very useful for me. Today, let's start with some basics of tmux.
Today's agenda:
- tmux Installation
- Start and Exit tmux
- Check the tmux sessions
- Create tmux session
- Attached tmux session
- Detach Tmux session
- Kill Tmux Session
tmux Installation
sudo apt update && sudo apt install tmux -yStart and Exit tmux
Start tmux:
tmuxExit tmux:
exitCheck the tmux sessions
tmux lsCreate tmux session
tmux new -s <myproject> # you can name any projectAttached tmux session
tmux attach -t <myproject> # here need to attach the same project to continue that session.
#Use `$ tmux` ls to check all available tmux session.Detach Tmux session
Press Ctrl + b, then d.
Kill Tmux Session
tmux kill-session -t myproject