Tmux

מתוך R63
קפיצה אל: ניווט, חיפוש

תוכן עניינים

כללי

טיפים לעבודה שיתופית: https://github.com/livingsocial/ls-pair

in "session" there can be one or more "windows"


cheat-sheet http://maleah.dayid.org/comp/tm.html

screen

tmux scroll mouse wheel

To scroll within history of the output You would use

^b + [ 

then use arrow + PgUp +PgDown. To exit the copy mode, press ESC

http://superuser.com/questions/210125/scroll-shell-output-with-mouse-in-tmux


פקודות

Ctrl-b from the session

To create a new window:

Ctrl-b c

To move to the next window in the index:

Ctrl-b n

Rename the current window: (not all session)

Ctrl-b ,

Rename the current session: (not window name, it the all tmux)

Ctrl-b $

To move backwards in the index:

Ctrl-b p

To detach me from a session:

Ctrl-b d

To detach other from a session: https://coderwall.com/p/vszahq

Ctrl-b D

New Window Default Name

http://superuser.com/questions/707421/tmux-new-window-default-name

tmux rename-window 'shell'

מכל חלון אחר

To re-attach to a session:

tmux attach -t [session name]

Sessions, like windows, are numbered beginning from 0. If you forgot which session you wanted to attach to, you can view active sessions:

tmux list-sessions
tmux list-windows

kill session

tmux kill-session -t myname
tmux kill-window -t3

rename session

PROMPT_COMMAND= # so that it will not change the name after the prompt
tmux rename-session -tfirst newname
#tmux rename-window -t4 newname

Swap windows order (location)

swap-window -s 3 -t 1

to let window number 3 and window number 1 swap their positions.

עוד

To detach other computer from a session

tmux remove attach user

from the (small) sesson

C-b D

to chose which clients to detach; it will also list they col/lines as well as the last used time.

from new terminal (TDB)

tmux detach [options]...

http://stackoverflow.com/questions/22138211/how-do-i-disconnect-all-other-users-in-tmux


close

תצוגת מספר חלונות במסך אחד

ליצירת חלון חדש אשר כולל חלון ישן, מהחלון הישן

Ctrl+b " - split pane horizontally.
Ctrl+b % - split pane vertically.
Ctrl+b arrow key - switch pane.
Hold Ctrl+b, don't release it and hold one of the arrow keys - resize pane.

הפרדה

Ctrl+b ! - break pane

הוא הפקודה split-window

תצוגת שני חלונות קיימים במסך אחד, הוספת מסך אחר למסך הנוכחי הפקודה join-pane

tmux join-pane -s WindowNum

תצוגת שני חלונות קיימים במסך אחד, חיבור שני חלונות מהצד הפקודה join-pane

tmux join-pane -s WindowNum -t WindowNum

מעעבר בין החלונות

Ctrl-b "Arrow key"

http://unix.stackexchange.com/questions/14300/moving-tmux-window-to-pane

ניתוק חלונות

sessions

tmux list-sessions

create new session

new login, type tmux and rename the sesson name

tmux list-sessions
Ctrl-b $

how to swap sessions

Ctrl-b (

http://superuser.com/questions/879190/how-does-one-swap-two-panes-in-tmux


Switch between sessions

C-b (          previous session
C-b )          next session
C-b L          ‘last’ (previously used) session
C-b s          choose a session from a list

https://gist.github.com/andreyvit/2921703


tmux move window between sessions

move-window link-window

בעיות

Tmux window name automatic rename

WIKIR63-010716-11

http://superuser.com/questions/306028/tmux-and-zsh-custom-prompt-bug-with-window-name/320316#320316

in your .bashrc or .zshrc seems to solve the issue:

DISABLE_AUTO_TITLE=true

how do I reload it without logging out and back in

source ~/.bashrc

http://stackoverflow.com/questions/6041178/keep-the-windows-name-fixed-in-tmux in your ~/.tmux.conf

set-option -g allow-rename off

Tmux window name automatic

Tmux New Window Default Name http://superuser.com/questions/707421/tmux-new-window-default-name

changing the PROMPT_COMMAND in /etc/bashrc make in work. But when I su it not change the user name

tmux window name su the problem is that after su ${USER} not change

in PS1 \u the username of the current user is change

screen PROMPT_COMMAND su user

PROMPT_COMMAND su root setting PROMPT_COMMAND to display user after su root

http://stackoverflow.com/questions/38147605/setting-prompt-command-to-display-user-after-su-root

Tmux window prompt PS1

Linux auto prompt

tmux prompt Tmux prompt not following normal bash prompt PS1 \W http://stackoverflow.com/questions/21005966/tmux-prompt-not-following-normal-bash-prompt-ps1-w

tmux may be creating non-login shells, in which case .bashrc would be sourced instead

the fix put into ~/.tmux.conf

set-option -g default-command bash


http://www.linuxquestions.org/questions/showthread.php?p=5569809#post5569809 http://www.linuxquestions.org/questions/linux-newbie-8/setting-prompt_command-to-display-user-after-su-root-4175583647/ http://www.unixguide.net/unix/faq/2.4.shtml

בעיות התקנה ב- CENTOS5

non root user error create session failed: : No such file or directory

http://serverfault.com/questions/405391/tmux-wont-run-as-non-root-user

export TEMPDIR=/tmp

not help

to debug

strace -f -e trace=file tmux
[pid 16716] open("/dev/ptyp0", O_RDWR)  = -1 EACCES (Permission denied)

tmux "create session failed" "No such file or directory" pty "Permission denied"

https://gist.github.com/timruffles/5037956

#/usr/sbin/usermod -G tty username


create session failed: : Exec format error

tmux "create session failed" "Exec format error"

http://readystate4.com/2011/01/02/fixing-tmux-create-session-failed-exec-format-error/

sudo mount devpts /dev/pts -t devpts

--Admin 15:30, 25 ביולי 2014 (IDT) TODO:

You probably don’t want to run this command every time (or give your users access to sudo.) Add this to your /etc/fstab and you can continue with your tmux screen splitting.

tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0 
sysfs /sys sysfs defaults 0 0

כלים אישיים