A wrapper around tmux allowing quick switching and session saving.
Project description
control-tmux
This is a wrapper around tmux that allows you to quickly switch between sessions, save sessions while preserving bash history.
Installation
Unpack the source, then run ./install
and follow the prompts.
You will be prompted to add an alias 't' to your .bashrc. This is highly recommended. It
will only apply to terminals opened in the future, but you can run exec bash
to reload
you aliases in an existing terminal.
The installer will also create a default .tmux.conf if you don't have one. This configuration is not necessary for control-tmux to run, but includes many bindings that make tmux easier to use.
Simple usage
These usage examples all assume you have aliased t
to control-tmux
during installatin
If run without arguments, t
or control-tmux
will list all your current sessions:
To start or switch to a session named blah
, just run t blah
:
This works whether you are running from within tmux or outside of it. If run from outside,
this runs either tmux attach -t blah
or tmux new-session -s blah
(if blah
doesn't
exist) . If run from inside tmux, then it does tmux switch-client -t blah
, which
switches your current client to the session named blah
.
In either case, this will detach any other terminals that are connected to blah
, unless
you prefix the session name with n
(e.g. t n blah
)
To save the blah
session to ~/.tmuxsave/blah.zip
, run t s blah
. To restore, run t r blah
. Restore only works when the session doesn't already exist. You can save all open
sessions by running t s all
:
Restoring a session restores the current working directory and the command history of the shell running within it. It does not automatically restart any commands that were running.
Recovering from a crash
The bash hooks in .tmux.setup.sh
write your history to disk as soon as you launch a
command. In most cases, after a power failure or crash, the session data will be
recoverable. All you need to do is run t s all
before running tmux.
If you forget and try to run t <session>
before t s all
, then it will start a new
instance of tmux and running t s all
will save the sessions from the new index. However,
the data for the old session is still present in ~/.tmuxsave
. Run ls -ld ~/.tmuxsave/tmux-default-*
to see all previous sessions. Each directory will have a
timestamp indicating when that particular instance of tmux was started. Once you have that
directory, just run t -s ~/.tmuxsave/tmux-default-2018-XX-XX__XX-XX-XX s all
and it will
save the sessions from the previous instance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for control_tmux-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47b35daa22a9b5a1491e0a1a8e70c5df887a81edbbe5c319b9da704b928d2691 |
|
MD5 | 8f5cf630955d1ec13432ba2e75d103e2 |
|
BLAKE2b-256 | a9ec9b102abc3e6de92f048ace9dd022988d605712fae0e2bec6ce891973eceb |