brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Ctrl-b d detaches from tmux and leaves everything running

Tmux
~/tips/tip-tmux-detach

Ctrl-b d

Leaves the tmux session without stopping anything in it, so you can come back later.

You close your view of the session and the work goes on. That is what tmux is for.

Ctrl-b d

You return to the plain shell, and tmux prints [detached (from session name)]. Everything in the session keeps running, including long commands. Reattach with tmux attach, or tmux attach -t name when there are several sessions.

If your SSH connection drops, tmux detaches for you. The session is still there when you log in again. The shortcut is for when you decide to leave on purpose.

Use tmux ls to see what is still running. A session that is forgotten there keeps using memory, so close the ones you no longer need.

Try it without risk: start a throwaway session with tmux new -s scratch, use the shortcut or command above there, look at what changes, and close it again with tmux kill-session -t scratch. Nothing else on your machine is touched.

Further reading: tmux manual page (OpenBSD, official), tmux wiki: Getting Started (official)

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link