Showing posts with label tmux. Show all posts
Showing posts with label tmux. Show all posts

2014-01-20

Display the hidden output of a command in a separate tmux pane

Sometimes you want to see what is going on in a middle of a pipe between commands.
For example, vim calls a tool and crashes, the error message doesn't say anything because vim could not parse it.
Here is a trick to copy the output of the command in a separate tmux pane while preserving the original output.
Put a shell script at the place of the original command and rename the original command to here "original_cmd"
#!/bin/bash
/bin/original_cmd | tee `tmux splitw -v -P -F '#{pane_tty}' read`
For example here it will execute "/bin/ls" normally on the top AND copy in realtime its output on a new pane below.

Happy debugging !

2013-10-14

Taking over a resized tmux session.

So I use tmux quite intensively and I reuse my long lived session from my workstation and my laptop.
The thing is when you come from a low res screen to an high res screen you can land on a resized session like that :
Tmux is simply trying to accommodate to all the client currently connected. If you left open your session on your laptop at home or simply closed it quickly, you might be stuck in this situation for a while.
Here is how I unstuck myself from within tmux...
tmux detach -a
Or in your .zsh/bashrc as an alias
alias takeover="tmux detach -a"
Fixed: