24 ms·
Tools I Use - tmux
- hkarthik 15y agoThe other awesome thing about tmux is being able to use it for remote pairing with vim or emacs. When working remotely, I use this a lot.
- chrismealy 15y agoI used screen for 15 years but recently switched because I liked tmux's easy-to-read conf file and scriptability. Mac OS X users watch out, launchctl commands barf mysteriously inside of tmux.
- weehuy 15y agoThis should be added to a FAQ somewhere. Took me ages to figure it out on my own, especially since the error msg is so generic -> http://pig-rabbit.com/tmux-and-launchctl http://pig-rabbit.com/tmux-and-launchctl
- nixme 15y agoJust use https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard. Works for pbcopy, pbpaste, and launchctl. Then just alias launchctl to "reattach-to-user-namespace /bin/launchctl"
- Dejital 15y agoThere are multiple problems with tmux on OS X. pbcopy and pbpaste, for instance, are entirely unusable. Even if tmux has some nice benefits over screen, it probably isn't worth it to the Mac user to switch.
- thristian 15y agoThere's a similar-sounding problem in the X11 environment on traditional Unix systems: the current default graphical display is in the $DISPLAY environment variable, while authentication information is in ~/.Xauthority. GNU Screen tends to blindly inherit those settings, so you can freely start GUI apps from inside screen and have everything work... until you try to reattach screen from inside a different GUI session, or from a non-GUI session (say, ssh). Then all the processes you run inside screen go looking for a GUI session that no longer exists and everything starts breaking in odd ways. tmux actually has a way to work around this: whenever you reattach, it looks at a whitelist of environment variables representing external resources, and either updates its own environment with the new values, or removes those settings from its environment if the place you're attaching from doesn't have them available (naturally this doesn't magically fix any processes already running inside tmux, but every new window you create will be set up correctly - unlike screen, where you have to kill every window and end the session). By defaut, this whitelist includes variables used for X11 authentication and the SSH agent. If OS X has a similar environment-variable-based connection system, you might be able to add it to tmux to get things working.
- sciurus 15y agoGNU Screen allows you to do something similar using its setenv command. For instance, to update the value of $DISPLAY to a new ssh session's value you could run "screen -S foo -X setenv DISPLAY $DISPLAY" before running "screen -r foo". I have a wrapper script that reproduces tmux's behavior of automatically updating a set of environment variables. It goes a step further and also updates them in your running bash shells. For this to work you have to register a signal handler in your .bashrc that sources a file with the new environment. The script is available at https://github.com/sciurus/splatbang/blob/master/rescreen https://github.com/sciurus/splatbang/blob/master/rescreen
- decklin 15y agoYou can use this for that: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard The documentation recommends changing tmux's default command, but if that weirds you out, a simple alias to "reattach-to-user-namespace pbcopy" also works.
- jamiemill 15y agoInstead of trying to make the native copy/paste work, can anyone think of a way to set up key bindings in OSX to mimic copy/paste but store the text in /tmp/mypasteboard or something? Would AppleScript do it and would that work in any application?
- alwillis 15y agoLooks like there's a fix for using pbcopy and pbpaste with tmux on Mac OS X: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
- zobzu 15y agowhat i like about tmux: - its actually faster than screen to startup - all the stuff everyone lists/knows/blog post what i dont like about tmux: - it schokes on some weirdo programs while screen seems pretty reliable on anything thus i end up on screen more often than not
- keeperofdakeys 15y agoTry modifying your TERM environment variable, I've found it can be quite sensitive to that.
- sequoia 15y agoSome other cool features: Monitoring background windows: with monitor-activity, monitor-silence, and monitor-content [term], you get a visual notification when there is activity, a certain period of silence, or an occurrence of [term], respectively, in a specified background window. Sometimes I open several error logs in a background window and monitor-activity so I get a notification if anything is written. synchronize-content: I've only used this a few times but it's a neat trick! With several panes open in one window you can send keystrokes to all the panes at once. I've used this while connected to more than one server to compare the contents or make changes simultaneously. I won't claim this is the safest way to work but it comes in handy. Managing windows and panes in tmux is pretty painless, in my experience. Resizing, switching, etc. are all very simple. One final feature I like, tho it's trivial, is the "show the time" command (bound to prefix-t). Invoking it gives you a nice big digital clock in a window or pane. I put this below my ttytter pane so I don't lose track of time. :) I don't know how much of this you can do in screen as I've never used it, I'm sure there's a lot of overlap, but as a sometimes very critical software user let me say: I love tmux.
- tkrajcar 15y agoI use screen regularly, but mostly to be able to attach and detach to sessions as I move between work, home, etc. tmux users frequently tout its ability to do nifty split screens and other window management, but I'm not sure I understand the value of doing this over just starting another iterm2 window/tab and using regular window management tools. Cmd-tilde or Cmd-tab is one less key than Ctrl-a, h.... :) What am I missing?
- mminer 15y agoAdditionally, iTerm2 supports splitting windows vertically and horizontally, with niceties like dimming inactive panes. However, not all terminal applications support this. When I move from my laptop to a public computer to my iPad I appreciate a consistent experience. If you don't use split windows in the first place then tmux's functionality won't thrill you, but as someone who logs into my dev machine from multiple locations I prefer to rely on the actual terminal application and host operating system as little as possible for window management.
- bricestacey 15y agoIf you do dev work on a remote server this is usually not an option unless you're willing to open half a dozen ssh connections, but then none can communicate with each other easily.. I'm sure iterm2 does a fantastic job doing window/tab management, but I spent almost 5 years working over ssh. edit - tmux is scriptable too, so you can setup a dev environment using a shell script (I do this, setting up my rails server, console, resque workers, etc, etc).
- alwillis 15y agoGood news for iTerm2/tmux users: the next version of iTerm2 (according to the author) has deep tmux integration: http://groups.google.com/group/iterm2-discuss/browse_thread/thread/a6cf489c24b5a241 http://groups.google.com/group/iterm2-discuss/browse_thread/...
- jodrellblank 15y agoI tried tmux earlier today and found a very nice feature: I have an SSH session to a remote linux server from my computer, then connect a new SSH session from my BlackBerry, and run 'tmux attach' in it. The tmux session on the computer resizes to the size of the BlackBerry terminal, and both PuTTY and BBSSH show the same content, and both can interact with it. Disconnect the BB, and the computer terminal resizes back to what it was.
- tobych 15y agoI do the same from my Android phone (using ConnectBot): I can run some long-running process and keep an eye on it while I'm out in the kitchen making a cup of tea. When I'm back in the office, I detach the Android session.
- te_chris 15y agoSo I've recently got into using vim and quite like the split screen features. How would I mix something like this in for doing day to day running commands and editing stuff with a vim split screen workflow? Sorry if this seems like a difficult question, but even stories of how people manage this would be great :)
- bricestacey 15y agoI am a tmux/vim user and I find this a constant problem. Split tmux panes don't allow your vim windows to communicate with each other (you could always fallback to using the system buffer, though that is often insufficient). Yet, split vim windows don't allow a shell in a single window.
- te_chris 15y agoTheres actually a vim plugin I've been using that comes with Janus that loads up a shell in a vim buffer. It's been quite helpful, but I still find myself having separate macvim and terminal windows open, especially for rails dev. I normally have vim open for editing and a terminal window open with tabs for rails console, guard for rspec, server and general terminal open.
- ibisum 15y agoI don't use tmux, but terminator instead. Where tmux is a terminal multiplexor, terminator is .. a terminal! With amazing split-window abilities .. So I work like this: a "main window" in terminator with my vim session (in which vim administers its own windows - great with cscope integration and so on) and two sub-windows. The two sub-windows are for doing things like shell hacking on the project, another for builds, and so on. To cut/paste between the windows, when necessary, I either use tee to put things in /tmp for easy ":r"-ing in vim, or I just use the window manager clipboard. In the 'main editing window' where vim has its own windows for each file and so on, yank/paste work great - to go from shell to shell, mouse-select/mouse-middle-button work great. Debugging, you say, with line-by-line code inspection? In a sub-shell: 'gdb -tui' is awesome. I also build most of my projects such that ':make' returns a proper vim clist that can easily be easily navigated through standard vim bindings.. I don't use tmux, screen, for the simple reason that I like the flexibility that having terminator manage the windows gives .. Check it out, in case you're interested.
- rlvesco7 15y agoI've been playing with byobu and I like it a lot. http://blog.dustinkirkland.com/search/label/Byobu http://blog.dustinkirkland.com/search/label/Byobu You can use either a screen or tmux backend.
- Drbble 15y agoMany previous discussions: http://www.hnsearch.com/search#request/submissions&q=tmux&start=0 http://www.hnsearch.com/search#request/submissions&q=tmu...
- benradler 15y agoIf you like tmux, you may love tmuxinator -- lets you keep your terminal sessions saved (even things like SSH that require login), and resume them exactly as you left. https://github.com/aziz/tmuxinator https://github.com/aziz/tmuxinator
- tikhonj 15y agoI actually use Emacs and shell-mode to do exactly this. It has its own advantages and disadvantages, and only makes sense for people already using Emacs, but it's definitely something to consider. A neat trick: by default, C-u M-x shell opens a shell with a custom buffer name in another window (in Emacs, the different panes are called "windows") in a specified directory. If you're editing a file remotely with TRAMP, the shell will be opened remotely as well. I find this really useful when I'm editing multiple files on multiple remote systems and need to run some commands. This also integrates well with the rest of Emacs, making working with multiple shells, different files and other stuff really easy.
- thealistra 15y agoThe best thing I ever did in tmux, was to set a myTerminal variable in xmonad to "urxvtc -e tmux". So every terminal window I open already has a tmux inside and I never have that "oh, it would be nice if I haven't forgot to turn tmux on" feeling.
- ibisum 15y agoI get the same effect by using a different shell: terminator Monday morning: Fire up terminator, hit Ctrl-Shfit-O, Ctrl-Shift-E (3 windows, a 'main window' and two 'sub-windows' that are side-by-side), fire up a build in a sub-window, Ctrl-Shift-N to move to the 'main' window, fire up "vim -O sources/*" .. and .. I'm done with window management for the week. Seriously great way to organize the flow of my main tools!
- pyrhho 15y agoI keep having this nagging feeling I should use tmux more often. Right now I use it for remote pairing type stuff, but I can never bring myself to use it regularly. I love tmux, and it's super useful, but I just can't deal with the way it breaks scrolling. tmux and screen both horribly break scrolling and reverse searching. I'm not sure what the fix is, but until that works I can't see myself using it regularly.
- DrCatbox 15y agoCTRL+B (or whatever key to get into tmux mode input) then Page Up/Down to scroll or keyup/down. Then just esc when you are done scrolling. Works fine here, havent needed to mock with settings to make it work like this. But the tildas scrollbar is broken by tmux, and the usual shift+pageup, and mousewheel to scroll... but thats okay.
- pyrhho 15y ago> [...] but thats okay. Agree to disagree, I suppose... How do you do reverse search, though? Any replacement for ITerm's Ctrl-F?
- DrCatbox 15y agoCTRL+R ? Like normal. Is iTerm another iProduct? Never used macosx, wouldn't know. All terminals (GNU/Linux) Ive used tmux on, ctrl+r works, and scrolling as described in previous post.
- sequoia 15y agoWhen you're in copy-mode (activated by prefix-[ also prefix-pgup as mentioned above) search is like vi or emacs depending on your copy-mode (vi by default I believe). SO: / to search down, ? to search up. If you want to search from the top down, hit "g" in copy-mode to go to the top of the buffer (in vi mode). "G" to go to the bottom. These, especially /, are really common conventions. / is used for search by vi, less, Opera (Firefox now too I think), even twitter.com.* My point is that / and ?, and to a lesser extent g/G/etc. soon becomes second nature and are worth learning because they are so common. How do you search backwards from the bottom in iTerm? See "copy-mode" for more info http://www.rootr.net/man/man/tmux/1 http://www.rootr.net/man/man/tmux/1 *twitter.com (as well as duckduckgo.com and to a limited extend slashdot) uses some sweet vi keybindings. Try n, j, k, r, etc.
- anddd 15y agoftfy - screen supports vertical splits too: ^A |
- technomancy 15y agoOnly in very recent versions; on most distros it means compiling from CVS.
- kazoolist 15y agoIt's been supported in Ubuntu since at least 10.10, which isn't ancient, but I'm not sure it counts as a "very recent version".
- gaving 15y agoBig thing holding me back from tmux is the lack of cygwin support for (unfortunately) my work environment. Otherwise, I'd switch cold turkey.
- g3orge 15y agoI just switched. The only thing I changed is the prefix to Ctrl-A like Screen.
- Ryan_Shmotkin 15y agoOr if used localy, go all in and install XMonad or Awesome. And get ALL your apps/windows tiled !
- akg 15y agoI love using terminal multiplexors, but prefer GNU Screen since it is almost always available wherever I need it. For those interested, I use the following to show a status line -- comes in handy when you want to name difference screens. You can always name a screen using "C-a A" hardstatus alwayslastline "%?%{yk}%-Lw%?%{yk}%n*%f %t%?(%u)%?%?%{yk}%+Lw%?"
- keenerd 15y agoI prefer GNU Screen for the nethack mode. It is a shame that Screen does not ship with a nicer hardstatusline by default - you can do some really amazing things there.
- phzbOx 15y agoI went from "Terminal" to "screen" to "tmux" to "stumpwm". Baiscally, what I really liked of tmux is the way I could frame my terminals logically or fullscreen easily. I also really enjoyed the fact that I had multiple "workspace". Basically, my WM was just not appropriate for the way I liked to work. Stump fixed that. It's dynamic, I can hack it from emacs and it has everything I liked about tmux. Obviously, I'm talking from my desktop perspective, if I'm working somewhere else remotely it's a different story.
- technomancy 15y agoWhat I don't understand is how both screen and tmux ship with bindings that conflict with readline. Did nobody notice, or did nobody care? Neither is usable without fixing this in config.
- lifthrasiir 15y agoHow about C-q as an alternative? It is same as C-v (in the default readline mapping) and generally unused. It does not conflict even with Windows' use of C-v.
- yason 15y agoConfiguring the prefix key to C-z is quite harmless, C-z C-z for suspend is quite ok. (As a bonus hint, binding subkeys with control it's faster to send commands: C-z C-n is faster than C-z n, you just keep control pressed during the command sequence.)
- technomancy 15y agoOf course, it's easy to fix. It just boggles my mind that they would have made that mistake in tmux to begin with when you consider that it's one of the main complaints people have about screen and tmux was supposed to be a "better screen".
- dolzenko 15y agoFunny, just went from screen to tmux in one hour, and that was the first the exact same thing I felt odd about :)
- vectorpush 15y agotmux is amazing. A really handy command is send-keys. I use a fullscreen split pane setup with VIM in one and elinks in the other. Inside my .vimrc: command W :w<Bar>execute 'silent !tmux send-keys -t 1 C-r'<Bar>redraw! This saves the buffer then sends ctr+r to pane 1 (elinks in my case), which causes a page refresh. It's very useful when debugging web scripts.
- joeshaw 15y agoI absolutely love tmux and use it everyday, but the killer feature I really want is tighter integration with a terminal emulator like iterm2. I would love to be able to attach to a tmux session with iterm2 and scroll using two-finger scrolling, while still being able to detach from the session and re-attach remotely. It would seem like this would be a possibility given tmux's design, which is a lot more flexible than GNU screen's.
- evgen 15y agoYour wish has been granted. See some of the recent nighties for iterm2 and associated discussion in the iterm google group.
- justinlilly 15y agoI was rather inspired by this and decided to write up my tmux config with org-babel as literate programming. Hope someone likes it: http://justinlilly.com/dotfiles/tmux.html http://justinlilly.com/dotfiles/tmux.html
- dolzenko 15y agoOne note though - both screen and tmux introduce some delay making the text appear a tad slower (I'm using it over SSH strictly, no idea about 'native console'), does anyone know the solution?
- Nick_C 15y agoI think that is more to do with SSH than screen or tmux. I just tested it on a SSH session across the Pacific. No difference whether it is a straight xterm or if it is within a screen session.
- dolzenko 15y agoNick, thanks for reply, I'm definitely seeing the difference, I will do more tests to figure our the bottleneck, have to think a bit about how to measure the delay exactly too (currently I'm using SecureCRT as SSH client, should probably try something else)