Tmux 1.9 released
sourceforge.net
sourceforge.net
I had a feature request (256 colors in fbterm so you can get 256 color tmux/vim without x), quickly got patch code, got support (I had never used patch before and didn't tell it to ignore whitespace) and when it worked, was told it would be in 1.9, and there it is. :-)
I'm blaming you =P
In all seriousness actually trying to get 256 colour mode auto detecting and working reliability across different xterms, tmux/screen, ssh and so on, without some hack that forces the 256 on even when it's not supported seems impossible :/
I added the following to my zshrc, which seems to have helped. Why don't these terminals report 256 color mode by default?
if [ "$COLORTERM" == "yes" -a "$TERM" == "xterm" ]; then
export TERM=xterm-256color
fiI suspect terminals don't set 256 colors by default for backward compatibility reasons. tmux itself didn't assume, you needed something in your config file or a command line option. Now though, I believe it can detect it based on your term.
Sidebar: if you're a die-hard tmux user in Linux, and you do something like, say, open vim and then realize you haven't opened it in tmux, check out https://github.com/nelhage/reptyr - it lets you do things like ctrl-z to background vim, start tmux, then steal the vim process into your new tmux session. Pretty cool!
http://askubuntu.com/questions/423529/how-to-efficiently-swi...
$ stty erase ^?
to recognize DEL (ASCII 127, or ^?) as backspace. I have that in my .bashrc on a particular machine that gives me this problem...
1) You have to have a separate terminal window for the 'control' process.
2) Now creating new tabs / windows automatically creates them in said tmux session (unless you manually use the "Profiles" drop-down menu). It would be nice to use Tmux as a way to create a window full of tabs in a scripted way (a la Tmuxinator), but not be forced to use a single Tmux session for everything.
I know that scrolling is one of the first non-obvious changes that seem irritating at first. But after you get used to scrolling with the keyboard, I find myself missing this possibility on 'standard' terminal windows.
Suddenly using the mouse to scroll feels really awkward and inefficient.
as for selecting copying pasting. i use these options
set -g mouse-resize-pane on
set -g mouse-select-pane on
i can now select and resize panes with the mouse, and i can select while holding the option key on the keyboard.also if you set
setw -g mode-mouse on
you can scroll back with the mouse in the scroll back buffer without having to press c-b[ and it will still properly scroll everywhere else... vim/weechat/etc.on a mac, iterm2 does this natively(in linux it works anyway). but if you want to use that in terminal or totalterminal(quake term) you'll need to install mouseterm. I recommend using mouseterm-plus as i recall mouse term is no longer maintained.
edit: looks like the link is dead you'll have to build it yourself https://github.com/saitoha/mouseterm-plus
Sometimes your hand is on the mouse and it makes for sense to use it.
edit: corrected hotkeys
I don't mind people who don't want to use the mouse, that's fine, but personally I sometimes don't run tmux when I know it will upset my scrolling and cut+pasting.
What do you mean? Commands like tmux swap-window and tmux move window allow you do move the order of the windows / workspaces.
http://superuser.com/questions/343572/how-do-i-reorder-tmux-...
It kind of works in the end, but it's arguably a bit more awkward to use than in screen.
I agree that it does not work 'out of the box', but once setup, it works quite nice :)
Vertical splits were patched in and added a long time ago, screen is usually installed by default, so I know it is there on systems where I'm not allowed to install packages. I can share screen sessions with co-workers, split windows etc.
IIRC, that patch floated around for a while.
The other thing that tmux brings to the table is better scripting support than screen + things like tmuxinator (for me at least).
I use iTerm. I use ssh to regularly access about 20 other boxes. I create tabs for every task. So I might have 3 tabs for a single box. 1 to start/stop processes, 1 to edit files, 1 to tail logs to verify my crap's working.
I installed tmux and I couldn't figure out what I'd use it for. This might be completely wrong, but I thought it'd allow me to control multiple boxes from a single session.
For example, I have 5 production servers that set up the same way. I want to do the same thing on all 5 at the same time. So my input/output is multiplexed to 5 boxes in a 1:5 relationship. Only I couldn't get that to work. I got lost switching sessions/contexts.
Again, sorry for being thick. I feel like I'm missing something great here.
With tmux, no HUP happens on the server side so the process keeps running. Once your internet connection comes back online you ssh back into the machine and ``tmux attach`` to the previous session. And voilà, it is like nothing happened. All of your output from before is still there too.
It is always persistent so you have your tabs all set up on each server. You just attach to the sessions of TMux on the servers and don't have to ever create your complex scheme on your local machine. You can have them start on boot on the server and just attach to them via ssh.
My case I use WeeChat (IRC) on my home server always running and I just ssh to my server and attach to that session.
This should synchronize the input to all panes i.e. type in any one and it will be sent to all 5. to turn it off, just run the same command again. I don't know if tmux has equivalent synchronize-windows.
Here's how it looks http://i.imgur.com/dEpQYJf.jpg
* Tmux now runs under Cygwin natively.
I started using tmux just because I was frustrated that I would occasionally kill the terminal with Command + Q instead of just the current window Command + W. But now there is just so much of tmux that helps my daily work flow I don't know how I ever got by without it.
This kind of annoys me, but I'm successfully using this workaround (hinted at in the announcement):
bind c run 'tmux new-window -c "#{pane_current_path}"' bind-key '%' split-window -hc "#{pane_current_path}" bind-key '"' split-window -vc "#{pane_current_path}"
Anyone know why this change was made?
if-shell "[[ `tmux -V` == *1.9* ]]" \
'unbind c; bind c new-window -c "#{pane_current_path}"'Currently a byobu user, it seems fine so far. Wondering what others offer more than that.
I'll use screen when I need to run a long-running task and can't keep my terminal session open.
I use tmux with a script so that I can ssh into multiple nodes and broadcast the same commands to them all at the same time. Great for interactive deployments that I haven't been able to automate away with CFEngine just yet.
$ ssh hostname
$ screen
# some time later, you get disconnected...
$ ssh hostname
$ screen -x
# back to where you were before getting disconnected.Seriously, the amount of commands linux has that most people don't know about is staggering. This link[1] was on HN just the other day.
[1] http://www.danielmiessler.com/blog/collection-of-less-common...
I'm using screen right now to scp 4.5Gb from home to my Docker host. I'll close the terminal at some point and check progress tomorrow.
I guess you could do that in Docker.. but why would you?
https://twitter.com/j_melis/status/179173797285478400
Seems like a neat trick
My shell script takes in a list of tuples (hostname plus a special id that I need to paste for my tasks that's unique to each host), splits off a window pane for each hostname(tmux split-window -h), ssh's into each host in it's own pane, and turns on synchronization.
I did a little trick to setup pastebuffers to hold that special id from the tuple i passed in. And setup keybindings so that I can press a key combination to paste in that ID whenever I need it to each respective pane.
If I ever need to temporarily remove a pane or several panes from the syncronized session but keep the others synced, I just change focus to the pane I want to unsync and put it into copy mode with "Ctrl-b [". Can take the pane back out of copy mode by hitting "q".
So far it's made me much more productive when I have to run a bunch of identical commands on a cluster of nodes for which we have no defined process (i.e. I'm figuring it out as I go).
I'll need to sanitize the script, but I'll try to put up a github gist of the script later on.
> I'll need to sanitize the script, but I'll try to put up a github gist of the script later on.
If you wouldn't mind, I'd be hugely grateful as I often find myself having to do similar tasks as what you describe (and even wanted to set up a script to auto start sessions in different panes like you do but wasn't aware that was possible).
While I do use tmux quite heavily (to the point where I found myself needing to rebind a lot of the keys to be more vi like or more convenient to manage one handed), I reckon I still only use about 10% of it's functionality. So it would be good to see other solutions based around tmux.
bind S setw synchronize-panes
Without the on/off option, it acts as a toggle, making it a keystroke away.I sometimes need to do this with multiple VMs. I'm really, really not in favor of bash scripting, but I've found the following to suffice, without the tmux dependency:
for host in box1 box2 box3; do ssh $host 'command; command; command'; done
(This presumes you've set up ssh-agent or are using passphraseless keys and suitable stanzas in ~/.ssh/config; adjust to taste if not.)I'd never heard of using tmux in this fashion before. Is it that the task sufficiently resembles a nail, or does tmux provide some unique benefit here?
I use it all the time on my RasPi at work, running a mutt instance. I can hop in from any machine and have my 'native' email client accessible.
It's just an example. Tux lets you automate interactive shells.
https://github.com/andyhmltn/dotfiles
That contains two tmux config files that add a few things like CTRL+B thenSHIFT+P for a nice layout and a shortcut for switching between panes with ALT+Arrow keys
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
(...) For an IMHO even more convinient ALT+Number to switch directly to the tab in question, just like in firefox.
bind-key -n C-up next
bind-key -n C-down prev
ctrl-left and alt-left/right interfere with too many other cli apps.https://github.com/fishman/dot_files/blob/master/tmux/.tmux....
Cmd-shift-c: New window
Cmd-shift-l: New pane to the right
Cmd-shift-h: New pane to the left
Cmd-shift-k: New pane above
Cmd-shift-j: New pane below
Cmd-l: Focus pane on right
Cmd-h: Focus pane on left
Cmd-k: Focus pane above
Cmd-j: Focus pane below
Cmd-1: Select first window
Cmd-2: Select second window
...
Option-h: Previous window
Option-l: Next window
Command-/: Enter copy mode
I have the same bindings in MacVim. The nice thing about using command is that it doesn't interfere with other cli apps like ctrl.The following allows you to yank the tmux clipboard into the system clipboard: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
I do literally mean all the time. My current session has been running the same emacs process inside a tmux window for about 60 days now I think.
You can remap left command to left option, leaving right command as command so you can still cmd+tab out of iTerm. You might also have to to to Preferences -> Profiles -> Keys and on the bottom say that the left and right option keys both act as +Esc.
If there's a better way I'd be interested to hear it, but this works for me.
I do! eshell is a very good shell that integrates nicely with emacs. For instance, I love egrep in eshell, you can move your cursor over the output and emacs will take you right to the line that matches.
So let me temper that just a wee bit, I do use eshell a lot, but there are a few cases where it doesn't work quite well, but those cases are few and far between, certainly not enough to warrant using tmux, at least I can't be convinced yet.
EDIT: I said eshell integrates nicely with emacs. That's not true, it's a shell written in elisp for emacs, no integration whatsoever. Sorry, but I don't feel like rewording what I wrote, so just adding this edit comment ;)
And of course, if you need to use any sort of curses type thing, eshell (or M-x shell) often fails in ugly ways.
As for running grep/awk/sed in tmux being fast, I don't doubt running the individual program and getting your results is faster, but the interaction in eshell and going beyond, say, grep output and actually being able to go the the line in question, the whole workflow, is much faster than running grep and then firing up an editor on the file and moving to the line. That is the real power, the whole workflow is made faster such that the fact that grep is a slow elisp implementation doesn't matter. And elisp grep really isn't that slow, accessing the file system is the slow part and that's true for both implementations and both can benefit from aggressive file caching anyway.
The less I have to leave emacs during an editing session, the faster/more productive I'll be. And that's the real power of eshell IMO.
Maybe I should use eshell or one of the comint shells more. But I wouldn't want to leave bash/zsh behind -- I might as well be on windows then :) (which is, btw, a strong argument in favor of the workflow you're describing -- for those poor people who are forced to use windows, eshell is a blessing.)
Sorry, I never meant elisp grep was slow. I meant _piping_ was slow.
Here's regular bash in tmux:
$ wc -l fullform_nb.txt
1180517 fullform_nb.txt
$ time sort fullform_nn.txt |grep åbryug
114297 åbryug åbryug adj pos m/f ub eint normert 510 1
114297 åbryug åbryug adj pos nøyt ub eint normert 510 4
114297 åbryug åbryugare adj komp normert 510 5
114297 åbryug åbryugast adj sup ub normert 510 6
114297 åbryug åbryugaste adj sup bu normert 510 7
114297 åbryug åbryuge adj pos bu eint normert 510 3
114297 åbryug åbryuge adj pos fl normert 510 2
real 0m2.888s
user 0m9.570s
sys 0m0.132s
eshell: $ time sort fullform_nn.txt | grep åbryug
114297 åbryug åbryug adj pos m/f ub eint normert 510 1
114297 åbryug åbryug adj pos nøyt ub eint normert 510 4
114297 åbryug åbryugare adj komp normert 510 5
114297 åbryug åbryugast adj sup ub normert 510 6
114297 åbryug åbryugaste adj sup bu normert 510 7
114297 åbryug åbryuge adj pos bu eint normert 510 3
114297 åbryug åbryuge adj pos fl normert 510 2
111.725 secs
Note: the output from grep comes after about 20 seconds, then it runs for 90 sec's until time is done. In any case, way slower than bash in tmux (which is as fast as bash outside tmux). (Silly example, but my real oneliners tend to be rather longer and more cryptic …)And when I try to e.g. "sort -k2,2 -t$'\t' file" it gives zero results, doesn't even tell me whether $'\t' is unsupported, same deal if I try '\t', whereas in bash, if I try a plain '\t', sort at least tells me sort: multi-character tab ‘\\t’. In eshell, I might be mislead to thinking the grep gave zero results. To me, eshell is both slow and dangerous.
I'm happy eshell works for you, but it is just not usable at all for me. OTOH, I'm faster at typing alt-TAB than at C-x b esh RET, so I don't mind having to leave emacs as long as I only ever have to switch between the terminal and emacs.
$ tmux detach
$ tmux attach
This will deattach and reattach a tmux session. You can type ``tmux detach`` inside a tmux pane of the session you want to detach. Also the key combo ``Ctrl-b d`` will detach.If you mean a way to save the workspace configuration, tmuxp, teamocil and tmuxinator are great solutions.
(Note, I wrote tmuxp as a python project a few months ago.)
tmux new -s session_name
Then to reattach tmux attach -t session_name
Read it as "tmux, attach to session_name"Forget which sessions you have open? List them out!
tmux lsFor this reason, I typically simply 'tmux detach;tmux attach"