Tmox spawns a shell detached from the current terminal. The detached shell stays alive even after the terminal is closed. It's almost equivalent to Tmux that spawns multiple detached shells ("multiplexer"). Instead, Tmox detaches only one shell; hence "monoplexer".
Tmox was designed for a peculiar setup as follows.
- You don't have
root. - You can't install any program.
- You must hold the shell alive even after closing the terminal.
A very simple example of this peculiar setup would be using a cluster as a non-admin, where (for some reason) you need to keep your shell alive to maintain the connection to one of the cluster nodes but don't have any privileges to install extra programs to do so nor any authority to make you able to use the node anyway.
- Run
bash tmoxto spawn and enter a detached shell. - Press Ctrl+Q to detach from the shell (still alive).
- Run
bash tmoxagain to re-enter the detached shell. - Type
exitto close the detached shell.
- Like Tmux, Tmox doesn't save the shell across reboots; the detached shell will evaporate when the system that runs the detached shell shuts down or reboots.
- It's only about 150 lines! (About 110 lines without comments.) Go play with the code.
Click here for technical details.
While writing Tmox, I discovered some interesting technical details. I hope other people will find them interesting (or helpful).
- TODO: Launching an interactive shell:
bash -i - TODO: Detaching a process from the script:
nohup,set -m
- TODO: Redirecting stdio: regular file, FIFO
- TODO: "Faking" a normal pseudo-terminal: TTY/PTY,
script
- TODO: Forwarding stdin:
read,stty raw, ANSI-C quoting - TODO: Receiving stdout/stderr:
tail - TODO: Handling signals:
trap, Bash Control Sequence,kill 0
- TODO: Using
flock - TODO: Getting the current terminal dimension