tmux
This is an old revision of the document!
Table of Contents
links
run multiple sessions in multiple places
#!/bin/bash
# var for session name (to avoid repeated occurences)
sn=xyz
# Start the session and window 0 in /etc
# This will also be the default cwd for new windows created
# via a binding unless overridden with default-path.
cd /etc
tmux new-session -s "$sn" -n etc -d
# Create a bunch of windows in /var/log
cd /var/log
for i in {1..6}; do
tmux new-window -t "$sn:$i" -n "var$i"
done
# Set the default cwd for new windows (optional, otherwise defaults to session cwd)
#tmux set-option default-path /
# Select window #1 and attach to the session
tmux select-window -t "$sn:1"
tmux -2 attach-session -t "$sn"
Execute commands inside a window
tmux send-keys -t test:1 "ls" C-m
Share sessions between users
prepare the place
sudo groupadd tmux-share sudo addgroup tmux-share myuser sudo addgroup tmux-share myotheruser sudo mkdir /tmp/tmux-share sudo chgrp tmux-share /tmp/tmux-share sudo chmod -R 2775 /tmp/tmux-share
create the session
tmux -S /tmp/tmux-share/1 new-session -s mysession
connect to the session
tmux -S /tmp/tmux-share/1 attach -t mysession
Log output
tmux -S /tmp/tmux-share/test new -s test1 tmux -S /tmp/tmux-share/test pipe-pane -o -t test1 'cat >> tmux.log'
tmux.1485876134.txt.gz · Last modified: (external edit)
