User Tools

Site Tools


tmux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tmux [2017/01/31 16:22] – created ssm2017tmux [2022/02/07 13:29] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== tmux ======
 ===== links ===== ===== links =====
   * [[http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course]]   * [[http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course]]
Line 54: Line 55:
 tmux -S /tmp/tmux-share/test pipe-pane -o -t test1 'cat &gt;&gt; tmux.log'</sxh> tmux -S /tmp/tmux-share/test pipe-pane -o -t test1 'cat &gt;&gt; tmux.log'</sxh>
  
 +==== Admin config ====
 +in ~/.tmux.conf
 +<sxh bash>
 +# C-b is not acceptable -- Vim uses it
 +set-option -g prefix C-a
 +bind-key C-a last-window
  
 +# Start numbering at 1
 +set -g base-index 1
 +
 +# Allows for faster key repetition
 +set -s escape-time 0
 +
 +# Set status bar
 +set -g status-bg black
 +set -g status-fg white
 +set -g status-left ""
 +set -g status-right "#[fg=green]#H"
 +
 +# Rather than constraining window size to the maximum size of any client
 +# connected to the *session*, constrain window size to the maximum size of any
 +# client connected to *that window*. Much more reasonable.
 +setw -g aggressive-resize on
 +
 +# Allows us to use C-a a  to send commands to a TMUX session inside
 +# another TMUX session
 +bind-key a send-prefix
 +
 +# Activity monitoring
 +#setw -g monitor-activity on
 +#set -g visual-activity on
 +
 +# Example of using a shell command in the status line
 +#set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
 +
 +# Highlight active window
 +set-window-option -g window-status-current-bg red
 +</sxh>
 +
 +===== tmux php =====
 +<sxh php>
 +exec('sudo -u username sh -c "tmux new-session -dPs test"', $output, $code);
 +print_r($output);
 +print_r($code);
 +</sxh>
 +
 +/etc/sudoers.d/sudoers
 +<sxh>
 +www-data ALL=(ALL) NOPASSWD:ALL
 +# be carefull, it is better to filter the commands sending the script to a bash script
 +www-data ALL=(ALL) NOPASSWD: /var/www/mysite/commands.sh
 +</sxh>
 +
 +/home/username/.tmux.conf
 +<sxh>
 +set -g default-shell '/bin/sh'
 +</sxh>
 {{tag>tmux}} {{tag>tmux}}
tmux.1485876134.txt.gz · Last modified: (external edit)