I was trying to run the brand discovery scraper for the ShopNot in the background on my VPS. Then i found tmux. tmux is a terminal multiplexer. It can run multiple terminal sessions, and run them in the background.

The steps I took -

  1. SSHed into the VPS
  2. Started a tmux session with: tmux new -s test
  3. Activated the virtual environment inside it: source .venv/bin/activate
  4. Ran the Python file inside the venv: python3 discover_all_brands.py
  5. Detached without stopping the command: press Ctrl-b, then d
  6. Closed the SSH

I saved the logs using: python3 discover_all_brands.py | tee run.log

The run.log contained the command outputs.

Although, one could SSH back in and reattach with: tmux attach -t test

Some useful commands:

  • List sessions: tmux ls
  • Kill a session when done: tmux kill-session -t test
  • If the script prints a lot, one can still scroll inside tmux and monitor it live.

Nahin Bin Kaysar 27 May 2026 @ 2:45 AM