Hacker News new | past | comments | ask | show | jobs | submit login
My tmux setup (unwiredcouch.com)
183 points by rustledjimmies on Nov 15, 2013 | hide | past | web | favorite | 97 comments



I can't recommend Pragmatic Bookshelf's book on tmux enough: http://pragprog.com/book/bhtmux/tmux

It's got the whole thing covered end-to-end if you ever wanted to get around learning it.


Author of that book here. Thank you for the kind words.


Reader of that book, you finally got me to kick my screen habit with it and now I have a new tmux addiction.

That said, tmux is way easier to use compared to screen. And with 1.8 and text reflow it pretty much has every feature from screen I ever wanted/needed/used.


I also love the new zoom pane that comes with 1.8 prefix <c-Z>. It comes very handy!


Is there an option/way to have "lables" in panes. Just like you have a info bar for windows, I would love to label my panes. Normally have a bunch of panes setup for logs, and it would be really nice to label them so i could tell what is in each pane.


not that I know of. panes have numbers windows have names afaik but I might be wrong.


Didn't know about this. Love it. Appears to be prefix z for me. C-z seems to background the tmux session, which seems reasonable.


yes sorry, you are correct. prefix z it is.


Didn't know about that one, should have read the changelog more carefully! Thank you!


Another reader here. That book was enormously helpful for me, thanks!


Another reader here. Your book demystified tmux for me. Thank you.


I'll take every opportunity to just praise you good sir, and gush over your wonderful book. Because it is indeed a wonderful book. It sits happily on my shelf.


Can you make it cheaper to buy both ebook and the print book? Ideally, I would have hoped that the ebook would come free with purchase of a print book…I would really like to buy both


I just bought a copy. Can't wait to kick screen to the curb.


For the vim lovers, this trick is quite good :

  unbind [ # free the weird binding
  set-window-option -g mode-keys vi # switch to vi bindings
  bind Escape copy-mode # ctrl-a ESC put your pane in a kind of vi normal mode
  bind-key -t vi-copy v begin-selection # start a visual select mode with v like in vim
  bind-key -t vi-copy y copy-selection # yank with y
  unbind p # free another weird binding 
  bind p paste-buffer # paste with crtl-a p


How is p a weird binding? It's a pneumonic for "previous" and works the same as it does in gnu screen, which is tux's "competitor."


indeed, agreed. I only use the prefix number shortcut for that.


> It's a pneumonic for "previous"

I'm guessing this is autocorrect, but an autocorrect that knows 'pneumonic' (the Firefox spell-checker doesn't!) but not 'mnemonic' seems even less likely than a person who knows the first word but not the second.

Anyway, 'previous' is perhaps less likely to spring to mind than 'back' or 'reverse' or even 'last', each of which would have different mnemonics. ('Last' has a particularly good mnemonic if you keep your hands to the Holy Home Row, which is why vi users, who are most likely to worship at the Altar of the Home Row, can't use it.)


previous is unambiguous. Last is extremely ambiguous. Last = Nth element or current -1? Similar with back or reverse. Previous means N-1 every time. Also it's a pretty commonly used programmer idiom.


I've used tmux so much in the past... so much that the only thing that my OS would do is run tmux ;-) So I've decided to use a different window manager: StumpWM. So, in a nutshell, all my window manager is now a big tmux - and I run browsers fullscreen in some screens. That's the best coding setup I've ever had.


Love tmux

Here is mine - http://dhaiv.at/dotfiles/ I use ` (backtick) as my escape key, that makes jumping between windows just a double tap on `

`+" to list all windows, really handy.

`+| to split vertically

tmux.conf for interested https://github.com/ceocoder/tmuxrc/blob/master/tmux.conf


I highly recommend byobu - http://byobu.co - which front ends screen or tmux. It uses the function keys for switching around, gives a good status bar by default etc.


The last tip on naming windows after remote hosts is nice! Now it'd be nice if we could run similar to ssh's LocalCommand on exit too. Turned out that I'm not the first to ask this: http://unix.stackexchange.com/questions/40899/ssh-localcomma... With workaround too.

The downside is that if go like ssh A then ssh B, display doesn't update. But I don't this too often anyway.


I spent a bit of time trying to figure out why it didn't work for me. Then why I couldn't even do the usual echo -e ... to change my gnome-terminal's title. Turns out I already had a PROMPT_COMMAND set to echo the last command into the title which was overwriting my changes.


We use a combination of tmux and mumble to get multiple remote-working coders all looking at one screen. It's very useful, even if we sometimes type over each other. It's also great when somebody has to give a demo but only the guy 3 states away can really get things configured properly--just fire up a shared tmux session!


tmux is like that thing that you hear about quite often, that you think it's not that useful, but that, once you try, you realize why and where its fame comes from.

I adopted tmux about a month ago and I can't really complain much. It's just awesome. If you work a lot in the terminal (I do), I would highly recommend using it.


I did not switch yet. I use screen often, and each time I checked the diff with tmux it seemed to be the same thing with slightly different defaults.


I use screen quite a lot -- and with xmonad as my main wm, I really don't need many features from screen -- I just have one screen per terminal window.

A friend of mine uses OS X -- and there tmux comes more to it's right as there's no (Free) way to get sane (for biased values of sane) window management under OS X.

[edit: It might be worth noting, that after running into a lot of problems with unicode input and urxvt, I switched to sakura[1] for my terminal -- and it's basically a lighter gnome terminal that's easy to set up without any chrome. Under debian I bind that to my x-terminal-emulator alternative, and I can ctrl-enter to open a new terminal via xmonad (xmonad needs a short config to use x-terminal-emulator though).

[1] http://www.pleyades.net/david/projects/sakura ]


Well, if you use screen and it works for you, then it might be a good idea to keep using it. Why change something if it works? :D. Both tmux and screen are similar. By the way, that's the config I personally use and it works pretty well: https://github.com/tony/tmux-config.git.


How does that email script work? Here it is:

https://github.com/mrtazz/bin/blob/master/imap_check.py

This looks for a file at ~/.netrc

What is the format of that file? Google results can't find this being used for email anywhere.


I'm using the netrc account field as an identifier on which I filter account info in the lambda function. More info about fields are here http://linux.die.net/man/5/netrc


Mine looks like:

  machine smtp_server.company.com
          login user.name@company.com
          password supersecret


I've been using screen for years. It works well for me. Can someone list some reasons to switch to tmux? Just about the only thing which annoys me in screen is the awkward switch to "copy mode" to scroll, instead of just hitting PgUp.


no patching for vertical and horizontal splits (I know screen doesn't do one of them without a fair bit of work).

tmux isn't a dead project.

Spirit of exploration? I started with tmux and no screen experience, but I've converted a few people to tmux by them just giving it a chance, basically.


I found it helpful with z being the bind key. c-z c-z to switch windows. To send SIGSTOP, then ESC c-z. Checkout https://github.com/carun/dot-files/blob/master/.tmux.conf


Thanks for sharing! I was introduced to Tmux at work earlier this year. We used it primarily for remote pairing, but now I use it for anything and everything terminal.


One of things I've been meaning to ask: do people who use tmux mostly run a windows machine as their desktop?


At work I use Windows->Putty->Linux->tmux, at home I use Linux->urxvt->ssh->Linux->tmux and Linux->uxrvt->tmux. When working on a Linux machine directly, I also use a tiling window manager.


Do you mean as opposed to people who use screen, or as opposed to people who somehow do without either? Since tmux was invented in the OpenBSD world, I expect it's still mostly Unix users.


For me yes, Win7 + MobaXterm which totally rocks, so much so I paid for it. Worth the punt just for the X support i.e. PyCharm running on remote server with UI on my Win7 desktop.


No. It is very difficult to get tmux running on Windows. Not impossible, mind, but not as simple as e.g. 'brew install tmux'.


recent post on using tmux on cygwin inside a mintty https://news.ycombinator.com/item?id=6737795


Nope I use it almost exclusively in Linux.


I use a mac, and tmux essentially gives me a tiling window manager for most of my dev tasks (vim + terminals).


Nope. Linux, FreeBSD and Solaris. But mainly Linux


glad to see love for tmux. I've been a user for 3+ years. Thank you nicm.


Just this last week I was introduced to tmux, it's seriously awesome.


jnycs: you have been hellbanned for no particular reason.


Probably getting his very first comment downvoted a bunch triggered some heuristic. jnycs: email info@ycombinator.com to appeal.


I have my prefix key as alt-j. Very convenient.


I think this blog post needs some screenshots!


>But the years of using screen have ingrained in my muscle memory to use ctrl-a

I still don't understand how this happened to so many people. Ctrl+a is already taken, how did anyone ever use screen without immediately changing it to something that doesn't conflict with a frequently used shell shortcut?


The only thing ctrl-A is used for by me besides screen (or rather, tmux after I remapped it), is incrementing a number in vim. Not really a big deal.


Most people I know use it to go to the beginning of a line in programs that use readline, which includes the shell as well as most programming language interpreters.


You can set readline's editing mode to vi so that anything that uses readline will then have vi-style bindings. Very useful, particularly when combined with rlwrap for those few programs that don't have readline support.

Zsh doesn't use readline (it has it's own line editor) but it can be set to vi-style input too. (Actually, at least on my system, bash doesn't seem to be linked with libreadline.. I'm not sure if it is actually using readline or not)


Bash uses .inputrc which configures readline, so if it's not actually using libreadline, it's emulating it pretty well.


It looks like bash does use readline, though it's not dynamically linked with it (at least on my system). Kind of seems like bash and readline are intertwined more than I thought; the git repo for bash has a distribution of readline included in it.


That makes sense to me. The shell is fundamental to the system, and is so heavily intertwined with readline that it is very sensitive to ABI/API changes. Consider: if you upgrade your readline without upgrading bash, or vice versa, you lose the ability to fix the problem even in single user mode. Having Bash control its own readline usage seems like the safest option, though conceptually a bit more complex.


I started using screen before I started learning that facility. (At the time, I mostly used Windows, so the Home key was available.)

Of course, when I started developing on a Macbook, screen rapidly became problematic as there was no Home key and I started using Ctrl-A. For the moment, I'm developing locally so I don't need screen or tmux, but I'm working on off-loading to a VM and I'll be using tmux there for the purposes of maintaining my own sanity.


I map Ctrl-q to beginning of line in .inputrc.

    Control-q: beginning-of-line
I know, I know, now we are remapping all over the place. But my muscle memory for Ctrl-a was too ingrained after years of screen usage.


With a vimscript [0], ctrl-a can increment dates, times, roman numerals, ordinals, etc. Pretty damn handy along with ctrl-x to decrement.

[0] https://github.com/tpope/vim-speeddating


I actually do use that, but ctrl-a/ctrl-x is still something I rarely find myself using more than a few times a week. Still a great plugin though.


Indeed. I've been using Ctrl-\ as my Ctrl-a in screen (and occasionally tmux). Turns out that I never use that keystroke in real life.


I'd always used Ctrl-a in screen because it was the default. When I moved to tmux I just moved it there, but tmux lets me send the Ctrl-a key sequence through to those apps.

So if I want to go to the beginning of a line in Bash, I just press C-a C-a (which actually works if I hold down Ctrl and press 'a' twice.

Not a big deal at all, and since I remap Caps Lock to Ctrl, the command combo is right on my left hand. (I slide my hand over a bit as if I were playing guitar or piano, rather than stretch fingers, so pinky on CapsLock, ring finger on a.)


I've been doing the same for a while, despite the fact that C-\ is in fact sort of already "taken" by default (SIGQUIT). That's not something I use often, but when I want it it's still easy enough to get by just sending C-\ twice. The only downside is occasionally (whether by accidental double-triggering or hitting C-\ out of habit when not actually running screen) killing foreground processes by mistake.


You should, ctrl-\ is the best process killer. No way to escape from xtail without it, for instance. And sometime it will help getting out of python scripts like nosetests.


I use Ctrl-o as my key bind for tmux. Maybe Ctrl-\ is a better choice for me, since Ctrl-o conflict with something that I does not always using.


ctrl-\ here, too.

The guy introduced me to screen recommended it. His words were "if you're an emacs guy, having this mapped to ctrl-a is going to drive you crazy"


Agreed, I will be crazy if I use ctrl-a. Also it conflict with start of line of default bash settings


I've been using `


Same here. It's really hard to press if you don't swap Ctrl and Caps Lock though.


No key chords, just left pinkie, why would it be so hard?


My bad, I thought you meant Ctrl + `


For me ` is taken by tilda:

https://github.com/lanoxx/tilda


I use the Windows Menu key (the Windows key to the right of the spacebar) for that. Except I use yeahconsole, which is the same concept without the Gnome dependencies.

Such a handy feature, isn't it. I would be lost without my drop-down console.


Isn't that siginfo?

You can send it to ping on linux to print a report line without terminating, for example.


I use ctrl-_. In many terminals you can generate it with ctrl + 7 and/or ctrl + ?.


Well, some of use vi bindings, and Ctrl+a isn't as commonly used there.


Because ctrl-a is extremely simple, physically ... for one hand, etc.

ctrl-b is fairly quick and easy if you use two hands (which is inferior to using one hand) and is quite a bit more difficult than ctrl-a when using one hand.


I ctrl+b with my left hand only. Pinky on left ctrl, index finger on b. I've never had any issues with it.


You appear to have invented some other post to respond to, mine said nothing about ctrl+b.


Ctrl+b is the standard key combo for tmux, which is why that was mentioned in the article in the first place.


That has nothing to do with the subject of the post in question though. He asked how people ever got accustomed to ctrl+a in the first place, since ctrl+a is already taken by your shell and every readline app, so 90% of people immediately remapped screen to use something else instead of ctrl+a. Tmux and ctrl+b don't enter into the discussion at all.


You map CTRL+A x2 to send CTRL+A to the shell, and it works.


By default it's C-a a, which I like.


Yes I do sort of this, only I use CTRL+Z instead, works sweet:

  # C-z as prefix key. C-z C-z will send C-z to application, C-z z cycles last window
  set-option -g prefix C-z
  unbind C-b
  bind-key C-z send-prefix
  bind-key z last-window


I use screen/tmux control combos far more frequently than I've used ctrl-a for beginning of line. That's what the home key is for (cue thousands of vim users telling me I shouldn't use any key that wasn't on a keyboard 40 years ago).


Control-A / Control-E is by far the most uniform start of line/end of line keyboard shortcut in OS X, and moreover I can use it without taking my hands off home row.


I use Alt. No double strokes: https://github.com/nviennot/tmux-config


I use backtick. It's great not having to reach for a control or alt key to change window.

It is a minor annoyance in markdown but in shell programming I use `$(...)` instead, since it can be hard to tell if a character is a backtick or a single quote.


Agreed completely. I used Ctrl-] with screen and just kept that convention with tmux. Ctrl-a is a non-starter for Emacs users, and even neglecting that, there are many contexts where Ctrl-a/Ctrl-e navigation is enabled and useful.


Serious question, what does tmux have to offer emacs users? I used and loved tmux back when vim was my editor, but after switching to emacs (thanks evil-mode), I stopped using it because emacs seems to cover all the bases on its own.


Try running emacsclient inside tmux. It's a good combination.


For the same reason (I'm using Ctrl+a in the shell), I'm using Ctrl+q as prefix for tmux. I'm quite surprised that I've never heard of anybody else using this combination.


You might have issues if you ever accidentally hit ctrl-s and need to use ctrl-q.


Tmux is such a fantastic tool - its made a big difference to my work - thank you and congrats to the authors.


Couldn't agree more. Switching and committing to tmux (and wemux for pairing) has helped immensely.




Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: