recentpopularlog in

kme : tmux   88

« earlier  
tmux windows and pane split's on current directory (Example)
Apparently this behavior changed in 1.9, but the link to the changelog in this article is broken.

<code>bind-key c new-window -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
bind-key '"' split-window -v -c "#{pane_current_path}"</code>
tmux  movein  config  dotfile  fuckina  solution 
august 2019 by kme
tmux(1) - OpenBSD manual pages |
select-pane [-DdeLlMmRU] [-T title] [-t target-pane]
(alias: selectp)
Make pane target-pane the active pane in window target-window. If one of -D, -L, -R, or -U is used, respectively the pane below, to the left, to the right, or above the target pane is used. -l is the same as using the last-pane command. -e enables or -d disables input to the pane. -T sets the pane title.

-m and -M are used to set and clear the marked pane. There is one marked pane at a time, setting a new marked pane clears the last. The marked pane is the default target for -s to join-pane, swap-pane and swap-window.
til  tmux  tipsandtricks  windowmanagement 
july 2019 by kme
tmux send-keys syntax - Stack Overflow
This didn't seem to work for sending Enter,Enter,~,. (to disconnect a non-responsive SSH session); but then again, maybe I never had an SSH session to begin with ('bsub -Is' not 'bsub -ISs').
tmux  automation  reference 
july 2019 by kme
A minimalist guide to tmux | Hacker News
Well, I was half-joking :-) and I did expect that few people would know about C-\ for SIGQUIT. Myself, I find it very useful for programs written by people who think it's a good idea to capture SIGINT (it's not), because same people (and I will refrain from using adjectives) forget about SIGQUIT most of the time. Which means I can quickly kill a misbehaving program without typing something in a separate shell.
tmux  terminal  multiplexer  jobcontrol  keybindings  tipsandtricks 
july 2019 by kme
tmux-plugins/tmux-continuum: Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on. |
Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on. - tmux-plugins/tmux-continuum
tmux  plugin  sessionmanagement 
april 2019 by kme
tmux-plugins/tmux-resurrect: Persists tmux environment across system restarts. |
Persists tmux environment across system restarts. Contribute to tmux-plugins/tmux-resurrect development by creating an account on GitHub.
tmux  plugin  sessionmanagement 
april 2019 by kme
rgaiacs/swc-shell-split-window: Script to split the shell using tmux |
Script to split the shell using tmux. Contribute to rgaiacs/swc-shell-split-window development by creating an account on GitHub.
teaching  unix  shell  shellscripting  workshop  utility  software  tmux 
february 2019 by kme
vim - selecting text tmux copy-mode - Super User
You definitely want to enable the Vi mode, though:
setw -g mode-keys vi

because for the life of me, I can't figure out how to copy and paste with the Emacs-mode keybindings.
tmux  copypaste  clipboard  terminalmultiplexor  keybindings  vim  solution 
april 2017 by kme
Linux/Documentation/filesystems/devpts.txt - Linux Cross Reference - Free Electrons
I saw this on a Debian 8.6 (Jessie, kernel 4.4.19-1-pve) where /dev/pts/ptmx was c--------- and both Screen and tmux would just immediately bail out with no error messages. Even 'strace' wasn't much help in getting to the bottom of this, but The short-term fix was to 'chmod 0666 /dev/pts/ptmx', but adding the mount option discussed below might be a long-term fix.

There are 'lxcfs' entries in the list of mounts, so it could be the same issue discussed elsewhere that's related to containerization. I dunno. I'm satisfied now that I actually understand why the heck this was happening in the firts place.

- (SE thread that gave me the idea to start googling for 'ptmx' which eventually led me here)
As an option instead of placing a /dev/ptmx device node at /dev/ptmx it is possible to place a symlink to /dev/pts/ptmx at /dev/ptmx or to bind mount /dev/ptx/ptmx to /dev/ptmx. If you opt for using the devpts filesystem in this manner devpts should be mounted with the ptmxmode=0666, or chmod 0666 /dev/pts/ptmx should be called.
linux  screen  tmux  terminalmultiplexor  ptmx  devpts  permissions  sysadmin  solution 
december 2016 by kme
zsh - tmux exits abruptly right after loading - Unix & Linux Stack Exchange
My group wasn't being resolved by LDAP (showed as 'nogroup')--maybe that had something to do with it?
tmux  debugging  debian  maybesolution 
july 2016 by kme
tmux exits immediately after starting - Unix & Linux Stack Exchange
This little tidbit

If screen does not work as well, make sure you have read-write access to /dev/ptmx. If not, no new pty can be spawned and especially tmux terminates without an error message.

that eventually turned up, which recommends:
As an option instead of placing a /dev/ptmx device node at /dev/ptmx it is possible to place a symlink to /dev/pts/ptmx at /dev/ptmx or to bind mount /dev/ptx/ptmx to /dev/ptmx. If you opt for using the devpts filesystem in this manner devpts should be mounted with the ptmxmode=0666, or chmod 0666 /dev/pts/ptmx should be called.

and it seems that was the eventual solution.

This bug report could also be related, as the host where I experienced this problem had a bunch of 'lxcfs' entries in the mounts list:
tmux  screen  annoyance  ptmx  devpts  debian  jessie  solution 
july 2016 by kme
How to install new tmux 1.8 on Ubuntu 12.10 or 12.04? - Ask Ubuntu

12.04 AND UP:

sudo add-apt-repository ppa:pi-rho/dev
sudo apt-get update
sudo apt-get install tmux


As you possibly already realized, tmux version 1.8 is too new. As of writing this answer, version 1.8 is only 19 hours old.

There is indeed an official PPA for tmux, but don't expect new version to appear there instantly. It might take hours, days, and even weeks, and it's totally up to PPA maintainer.

If you for some reason need a newest version, then you might download the code and build/install tmux by yourself. Should not be a big deal, since tmux has dependencies only on libevent and ncurses packages, and both of these packages are present on most if not all of Linux distros. Just download the latest code, and type following via terminal:

$ sudo apt-get install libevent-dev libncurses-dev pkg-config
$ autoreconf -fis
$ ./configure
$ make
$ sudo make install
tmux  debian  ubuntu  build  fromsource  packaging  packagemanagement 
june 2016 by kme
SSH agent forwarding and screen
To have SSH within a screen session use the symlink, add the following line to ~/.screenrc:

setenv SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock

To update the symlink we'll use the ~/.ssh/rc file which is executed by SSH on each connection. This can be any executable file, so something like the following script will do:

if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock

Also, from the comments, the same thing can be done in a ~/.bashrc:

if [[ -n "$SSH_TTY" && -S "$SSH_AUTH_SOCK" ]]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock

And for tmux (courtesy:
# fix ssh agent when tmux is detached
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
screen  tmux  ssh  ssh-agent  dotfiles  solution 
june 2016 by kme
How to auto-update SSH agent environment variables when attaching to existing tmux sessions - Stack Overflow
There's an excellent gist by Martijn Vermaat, which addresses your problem in great depth, although it is intended for screen users, so I'm adjusting it for tmux here.

To summarize:

create ~/.ssh/rc if it doesn't exist yet, and add the following content:


# Fix SSH auth socket location so agent forwarding works with tmux
if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock

Make it work in tmux, add this to your ~/.tmux.conf:

# fix ssh agent when tmux is detached
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock

solution  tmux  screen  ssh-agent  dotfile  authentication 
june 2016 by kme
How do I equally balance tmux(1) split panes? - Unix & Linux Stack Exchange


select-layout even-vertical
Usually assigned to: C-b M-2


select-layout even-horizontal
Usually assigned to: C-b M-1
tmux  windowmanagement  multiplexer  hotkey  solution 
june 2016 by kme
meat on Twitter: "PSA for anyone who uses tmux or vim with iTerm2: "Edit > Selection Respects Soft Boundaries" is the best"
Only in the 2.9.x pre-releases, though (iTerm 3).
PSA for anyone who uses tmux or vim with iTerm2: "Edit > Selection Respects Soft Boundaries" is the best
iterm2  vim  tmux  tipsandtricks  terminal  mac  osx  textselection 
april 2016 by kme
Index of
A tmux dependency (sometimes, on really old systems).
tmux  library  dependency 
march 2016 by kme
linux - Making 256-color AND Line drawing characters both work in PuTTY - Super User
This did *not* work for me on 'down'.
Export NCURSES_NO_UTF8_ACS=1 to your environment, it should fix the problem by telling ncurses to always use Unicode box drawing characters when a UTF-8 locale is selected.
mc  screen  tmux  linedrawcharacters  annoyance  terminal 
february 2016 by kme
Tmux: Switch the split style of two adjacent panes - Stack Overflow
But it doesn't seem to do anything. Maybe I don't have the same problem as this guy.
bind -n M-f move-pane -t '.-'
bind M-f move-pane -t '.-'
bind -n M-r move-pane -h -t '.-'
bind M-r move-pane -h -t '.-'
tmux  annoyance  windowmanagement  maybesolution 
november 2015 by kme
Extreme Multitasking with tmux and PuTTY - BrainScraps Wiki - Wikia
#SSH Agent Startup Modified from:
start_agent() {
echo "Initialising new SSH agent..."
if [ ! -d ${HOME}/.ssh ] ;then
mkdir -p ${HOME}/.ssh
chmod 700 ${HOME}/.ssh
touch ${SSH_ENV}
/usr/bin/ssh-agent | sed 's/^echo/#echo/' >"${SSH_ENV}"
if [ ${rval} = 0 ] ;then
echo "Succeeded!"
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" >/dev/null
echo "Failed to write ${SSH_ENV}"
# Source SSH settings, if applicable
if [ "$(tty)" != '/dev/console' ] ;then
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" >/dev/null
if ! ssh-add -l | egrep '.ssh/id(entity|_dsa|_rsa)' >/dev/null ;then
if ps -fp ${SSH_AGENT_PID} | grep ssh-agent$ >/dev/null ;then
ssh  publickeyauthentication  putty  tmux  tutorial  newbie  linux 
november 2015 by kme
server - Changing shell colors: "dircolors -b command not found" - Ask Ubuntu
dircolors -p > ~/.dircolors

But what I actually ended up doing, since that didn't really work with tmux was to just alias 'less' to 'TERM=xterm-256color less'. I'm sure this will confuse me later.
screen  tmux  termcap  terminfo  annoyancesortof  solution  dircolors  colors  configfile 
november 2015 by kme
gnu screen - tmux man-page search highlighting - Stack Overflow
From the tmux FAQ:

mkdir $HOME/.terminfo/
# If your terminal supports 256 colors, use:
infocmp "$screen_terminfo" | sed \
-e 's/^screen[^|]*|[^,]*,/screen-it|screen with italics support,/' \
-e 's/%?%p1%t;3%/%?%p1%t;7%/' \
-e 's/smso=[^,]*,/smso=\\E[7m,/' \
-e 's/rmso=[^,]*,/rmso=\\E[27m,/' \
-e '$s/$/ sitm=\\E[3m, ritm=\\E[23m,/' > /tmp/screen.terminfo
tic /tmp/screen.terminfo

And tell tmux to use it in ~/.tmux.conf:

set -g default-terminal "screen-it"

Also, since 'dircolors' won't know what to do with 'screen-it':

# Source:
dircolors -p > ~/.dircolors && source ~/.bashrc

Then, inside tmux again:

C-b :source-file /absolute/path/to/.tmux.conf
tmux  less  terminfo  termcap  linux  annoyance  solution 
november 2015 by kme
keyboard shortcuts - How does one swap two panes in Tmux? - Super User -
The swap-pane command can do this for you. The { and } keys are bound to swap-pane -U and swap-pane -D in the default configuration.

So, to effect your desired change, you can probably use Prefix { when you are in the right pane (or Prefix } if you are in the left pane).

The -U and -D refer to “up” and “down” in the pane index order (“up” is the same direction that Prefix o moves across panes). You can see the pane indices with display-panes (Prefix q, by default).
tmux  hotkey  windowmanagement  solution  fuckina 
august 2015 by kme
christoomey/vim-tmux-navigator · GitHub
Note that tmux >= 1.8 is required:
Tmux Can't Tell if Vim Is Active

This functionality requires tmux version 1.8 or higher. You can check your version to confirm with this shell command:

tmux -V # should return 'tmux 1.8'

Basic setup:

* Nothing required in .vimrc; Pathogen works fine, so you can just 'git clone' into $HOME/.vim/bundle and you're all set

* for .tmux.con, add these lines:
# Smart pane switching with awareness of vim splits
# See:
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"

* ONLY custom mappings, add these lines to .vimrc:
let g:tmux_navigator_no_mappings = 1

nnoremap <silent> {Left-mapping} :TmuxNavigateLeft<cr>
nnoremap <silent> {Down-Mapping} :TmuxNavigateDown<cr>
nnoremap <silent> {Up-Mapping} :TmuxNavigateUp<cr>
nnoremap <silent> {Right-Mapping} :TmuxNavigateRight<cr>
nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
vim  tmux  windowmanagement  splits  mapping  configfile  movein  solution 
august 2015 by kme
session - tmux: how to put 2 opened windows side-by-side? - Stack Overflow
Actually I found the way to do that. Suppose the two windows are number 1 and 2. Use

join-pane -s 2 -t 1
tmux  solution  multiplexor  terminal  dammitbrain 
july 2015 by kme
VIM and TMUX crash course - Edge Coders (Fremont, CA) - Meetup
No matter how much features a modern fancy editor has, if it does not have the feature of (WORKS IN TERMINAL), then everything else does not matter.

But you don't have to sacrifice all these cool features, you can still be in your terminal and have access to a great editor, arguably, one of the best options out there. VIM

Tmux adds more features to your terminal. We will show you how to become a power VIM/TMUX user in this workshop.
vim  tmux  worksinterminal  sysadmin 
march 2015 by kme
linux compile: tty.c:1006 undefined ref to __b64_ntop
Re: linux compile: tty.c:1006 undefined ref to __b64_ntop

SOLUTION: Add '-lresolv' at the end of the 'LIBS=' line in the Makefile and try again.
tmux  centos  compiler  errormessage  builderror  solution 
march 2015 by kme
linux - Attempting to install tmux on CentOS 6.4 or CentOS 6.5 fails with error: ‘EVBUFFER_EOL_LF’ undeclared - Super User
Solution: install a newer libevent.

You may also run into the problem of
tty.o: In function `tty_cmd_setselection':
tty.c:(.text+0x537): undefined reference to `__b64_ntop'
, which is solved by adding "-lresolve" to the LIBS in the Makefile (courtesy:
errormessage  tmux  centos  centos6  build  devel  solution 
october 2014 by kme
tmux Configuration []
Maybe it's just impossible to set up and attach sessions within a config file. The sample script on this page just does it all from the command line, *then* attaches to it at the end:
tmux has-session -t dev
if [ $? != 0 ]
tmux new-session -s dev -n emacs -d
tmux send-keys -t dev 'cd ~/' C-m
tmux send-keys -t dev 'emacs -main-instance' C-m
tmux new-window -n dired -t dev
tmux send-keys -t dev 'cd ~/' C-m
tmux send-keys -t dev 'emacs' C-m
tmux attach -t dev
tmux  reference  dotfile  configfile  maybesolution 
october 2014 by kme
A Modern Space Cadet / Steve Losh
Seems like this article might have a solution for the lack of an Ins key on Mac keyboards.
keyboard  mac  osx  spacecadet  shortcuts  hotkeys  keybindings  utility  software  howto  mechanicalkeyswitch  tmux 
october 2014 by kme
keymapping - mapping function keys in vim - Stack Overflow
Your problem is that vim does not know what does terminal emit when you press <F2>. On some terminals it emits something like <Esc>[12~, so the vim quits current mode (or just beeps if it can't) (<ESC>), does nothing ([1: there must be some key after [, but not 1, so it does nothing) and changes case of two letters (2~). So, you should open .vimrc and write there the following:

set <F2>=<C-v><F2>

where <C-v><F2> means that you must press <C-v> and then <F2>. This line should tell the Vim the exact sequence of codes which is emitted by terminal when you press <F2>. After that, use noremap <F2> whatever and it should work. If it is not the only terminal that you are using, then you may want to put if $TERM==#"<C-r>=$TERM<CR>" before this line and endif after.

NB: The <F2> mapping is fine with TERM=xterm-256color. It's 'screen-256color' (so, inside tmux) where I have the problem. This fixes that:
set <F2>=^[[12~
set <F3>=^[[13~
set <F4>=^[[14~

noremap <silent> <F2> :FufBuffer<CR>
noremap <silent> <F3> :FufMruFile<CR>
noremap <silent> <F4> :FufDir<CR>
noremap <silent> <F5> :FufFile<CR>
noremap <silent> <F6> :FufBuffer<CR>
xterm  screen  tmux  termcap  vim  functionkeys  keybinding  configfile  annoyance  solution 
october 2014 by kme
vim freezes inside tmux - Super User
You might have hit Ctrl+S, which turns off flow control in terminals and stops the terminal from accepting input. It is reenabled by pressing Ctrl+Q.
Amazing how you correctly guessed the problem from such such a vague description. Thanks!

Indeed. But Ctrl+A is close to Ctrl+Q if you're not careful.
vim  tmux  solution  unix  flowcontrol  magickeys 
september 2014 by kme
Getting 256 colors to work in tmux - Unix & Linux Stack Exchange
Here's what I use:

~$ which tmux
tmux: aliased to TERM=xterm-256color tmux

and in in my .tmux.conf:

set -g default-terminal "screen-256color"

Aliasing tmux to "tmux -2" should also do the trick.
tmux  screen  xtermcolors  colorscheme  configfile 
september 2014 by kme
fluff: tmux - Resize pane to specific width and height

paneWidths=$(tmux list-panes -t $ses:$win | awk '{print $2}' | cut -c 2- | cut -f 1 -d'x')
paneHeights=$(tmux list-panes -t $ses:$win | awk '{print $2}' | cut -c 2- | cut -f 2 -d'x' | cut -f 1 -d']')

currentWidth=$(echo $paneWidths | awk "{ print \$($id+1) }")
currentHeight=$(echo $paneHeights | awk "{ print \$($id+1) }")

resizeNumW=$(expr $currentWidth - $width)
resizeNumH=$(expr $currentHeight - $height)

if [ ${resizeNumW} -ge 0 ]; then

if [ ${resizeNumH} -ge 0 ]; then

#echo ws: $paneWidths
#echo hs: $paneHeights

#echo cw: $currentWidth
#echo ch: $currentHeight

#echo rw: $resizeNumW
#echo rh: $resizeNumH

#echo dw: $dirw
#echo dh: $dirh

if [ ${resizeNumW} -ne 0 ]; then
tmux resize-pane -t $ses:$win.$id -$dirw $resizeNumW

if [ ${resizeNumH} -ne 0 ]; then
tmux resize-pane -t $ses:$win.$id -$dirh $resizeNumH
tmux  solution  configfile  annoyance  windowmanagement 
september 2014 by kme
Circuidipity | My tmux cheatsheet
This one has some information about creating custom layouts and storing them in a config file. Perfect for a 'multitail' session for monitornig log files.
tmux  terminal  multiplexor  cheatsheet  reference  alternativeto  screen  configfile 
september 2014 by kme
« earlier      
per page:    204080120160

Copy this bookmark:

to read