I use tmux as my screen multiplexer, and in the past, I used control-A d
to disconnect and tmux a -d
to reattach to the session. This gets cumbersome if I haven’t created a tmux session yet, since tmux a -d
will give me an error that no session exists.
Aliases to the rescue
To help start sessions, and now name them, I use the following alias:
alias tma="tmux new -ADs"
To create a session named main
or re-attach to a disconnected session, I can now type tma main
. The alias will create a session named main
if one doesn’t exist, or reconnect to the session named main
. This also makes it easy to create named tmux sessions without having to remember the syntax.
Top comments (0)