TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Getting started with Tmux

315 pointsby eaguyhnover 6 years ago

28 comments

0xmohitover 6 years ago
Some more resources for learning more about tmux:<p>- The Tao of tmux [0]<p>- A minimalist guide to tmux [1]<p>- Benefits of using tmux [2]<p>- tmux shortcuts &amp; cheatsheet [3]<p>[0] <a href="https:&#x2F;&#x2F;leanpub.com&#x2F;the-tao-of-tmux&#x2F;read" rel="nofollow">https:&#x2F;&#x2F;leanpub.com&#x2F;the-tao-of-tmux&#x2F;read</a><p>[1] <a href="https:&#x2F;&#x2F;medium.com&#x2F;actualize-network&#x2F;a-minimalist-guide-to-tmux-13675fb160fa" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;actualize-network&#x2F;a-minimalist-guide-to-t...</a><p>[2] <a href="https:&#x2F;&#x2F;blog.bugsnag.com&#x2F;benefits-of-using-tmux&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.bugsnag.com&#x2F;benefits-of-using-tmux&#x2F;</a><p>[3] <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;MohamedAlaa&#x2F;2961058" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;MohamedAlaa&#x2F;2961058</a>
评论 #17999770 未加载
cikover 6 years ago
Tmux is another one of those tools whose siren call I&#x27;d avoided for a good decade, continuing to rely on GNU Screen. Then, for the last time I reconnected to a split screen and screen lost my splits and tabs - it was enough for me.<p>Two years ago I finally changed over and I haven&#x27;t looked back. At this point, when I encounter something where I only have screen I&#x27;m rather annoyed by it - and I&#x27;ve set my tmux key mapping to basically mimic what I&#x27;ve been using screen for the last 20 years.<p>For me, tmux replaced every single feature that I used in screen. On the other hand, I&#x27;d be genuinely happy if it existed on the older OSes I randomly have to frequent, even if it&#x27;s understandably impossible.
评论 #18000047 未加载
评论 #17999488 未加载
评论 #17999668 未加载
bovine3domover 6 years ago
My favourite little tmux trick is in ~&#x2F;.tmux.conf:<p>`bind r attach-session -c &quot;#{pane_current_path}&quot;`<p>All the terminals I open start a new tmux session (left as an exercise to the reader). I change directory to whatever project I&#x27;m working on, hit `C-b r` and from then on all panes and and windows in that session will start in the correct directory. Saves me a lot of cd&#x27;ing.
评论 #18001429 未加载
评论 #18001544 未加载
hardwaresoftonover 6 years ago
tmux was an absolutely game changer for me. At first I thought I was fine just being really comfortable with shortcuts and splitting commands with my favorite terminal emulators but tmux along with tmux plugins ecosystem[0] is really a world of difference, and much better.<p>I haven&#x27;t gone so far as to change my default shell to tmux in the terminal emulator I use, for the sole reason that I imagine that I just don&#x27;t need tmux <i>every single time</i>. In reality, 99% of the time the first thing I do when I restart my computer and open a terminal and run `tmux`, and start setting up my workspaces based on what I&#x27;ve been doing, naming windows, etc.<p>The top two features I use every day:<p>- keyboard-only selection + cut &amp; paste between panes (yes, piping to xclip is good, but it&#x27;s nice when you can just enter the right tmux mode, use emacs&#x2F;vim keybindings to go up and copy out some text)<p>- easy&#x2F;instant resizing and organizing of panes<p>- naming&#x2F;breaking&#x2F;moving&#x2F;combining panes, to focus my efforts (something as simple as naming a window appropriately focuses my efforts inside that window)<p>An example of this is working with tools like `kubectl` that generate randomly named components that I have to list out @ the command line and do operations on, most of the time when I watch people deal with this in talks, they have to go and double-click-select or type things out.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;tmux-plugins" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tmux-plugins</a>
评论 #17999719 未加载
评论 #17999529 未加载
评论 #17999392 未加载
loranbriggsover 6 years ago
I find both tmux and Gnu Screen difficult to config (haven&#x27;t taken the time to learn) but I love the concept of them so I use Byobu (<a href="http:&#x2F;&#x2F;byobu.co&#x2F;" rel="nofollow">http:&#x2F;&#x2F;byobu.co&#x2F;</a>) on top of tmux&#x2F;screen to set common configuration for you. Byobu really lowers the amount of config and barrier to entry because Byobu uses common hotkeys. For example F2 for new window.
评论 #18000179 未加载
评论 #17999601 未加载
评论 #17999859 未加载
BlackLotus89over 6 years ago
I must admit I&#x27;m a screen guy. I feel not at home when I find a system without screen and I miss the &quot;killer feature&quot; of connecting to any tty at any baud rate<p><pre><code> screen &#x2F;dev&#x2F;ttyUSB0 9600 </code></pre> in tmux. But recently I tried to switch to tmux and found a few useful configurations.<p>1) I have alacritty as a terminal so no scrollback and no tabs (yeah there is a scrollback branch, but why duplicate functionality?) So my default setup right now is that alacritty (I use i3 so alacritty is bound to meta+enter) opens with this line (this way only one terminal can be opened and has always the same state)<p><pre><code> tmux attach -d -t alacritty || tmux new -s alacritty</code></pre> So I got scrollback and tabs. Also I added<p><pre><code> bind-key -n C-t new-window bind-key -n C-PPage previous-window bind-key -n C-NPage next-window </code></pre> to the config so I can use it like any normal terminal with ctrl+t (new tab) and ctrl + pgup&#x2F;down to switch between them. In theory I could even add shift with (C-S-t), but this somehow doesn&#x27;t work for me and I found conflicting information on it and some outdated infos so I just stopped looking.<p>The second configuration that I like to use is what everybody uses<p>2)<p><pre><code> unbind C-b set-option -g prefix C-a bind-key C-a send-prefix </code></pre> to change the prefix to the sane ctrl+a screen default.<p>Also setting colors is a must for neomutt and co<p><pre><code> set -g default-terminal &quot;tmux-256color&quot; </code></pre> I&#x27;m still experimenting with configs for my desktops and servers, but I&#x27;m feeling a bit more at home with tmux right now.<p>Oh and for anyone who doesn&#x27;t know of byobu check it out <a href="http:&#x2F;&#x2F;byobu.co&#x2F;" rel="nofollow">http:&#x2F;&#x2F;byobu.co&#x2F;</a> it&#x27;s a wrapper around screen and&#x2F;or tmux and is easy for beginners and a nice change for everybody else.
评论 #18001898 未加载
评论 #18000766 未加载
评论 #18001943 未加载
atrudeauover 6 years ago
One feature that I really like on my Mac was iTerm2&#x27;s persistence (tabs and outputs preserved across reboots). This is particularly important where I live because we have frequent electric outages.<p>I now have something on Tmux with <a href="https:&#x2F;&#x2F;github.com&#x2F;tmux-plugins&#x2F;tmux-continuum" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tmux-plugins&#x2F;tmux-continuum</a> .<p>That&#x27;s one of the best things about Tmux: there&#x27;s generally a way to get it to do what you need it to do. Or something close enough.
评论 #18000192 未加载
tjoffover 6 years ago
One issue I have with tmux is that you can&#x27;t resize the window to the current device. The developers seems to be very adament that it isn&#x27;t implemented.<p>Currently tmux will adapt the size to the smallest (on each axis) client. This doesn&#x27;t work well with persistent connections from a phone and PC since they typically have quite different window sizes.<p>In screen I hit ctrl-a + F to resize to current client and I miss it every time I use tmux.<p>Unfortunately I still prefer tmux, worth trying out if you haven&#x27;t!
评论 #17999308 未加载
评论 #18001919 未加载
评论 #17999324 未加载
评论 #18001938 未加载
BooneJSover 6 years ago
I use a macOS laptop with iTerm2 to connect to a remote tmux server running on Linux, and the iTerm2-tmux integration [0] is pretty great if you like multiple panes per window. I don’t have to mess with mouse mode for straightforward pane resizing, buffer scrolling, or copy&#x2F;paste text in the buffer. I recommend taking a look if you’re typing on a Mac.<p>[0]: <a href="https:&#x2F;&#x2F;www.iterm2.com&#x2F;documentation-tmux-integration.html" rel="nofollow">https:&#x2F;&#x2F;www.iterm2.com&#x2F;documentation-tmux-integration.html</a>
评论 #17999970 未加载
aap_over 6 years ago
I&#x27;m using tmux myself for persistent shells on remote machines (mostly irc), but not much otherwise. Lots of people and guides make it sound like it&#x27;s also very useful when you&#x27;re working locally. Can someone enlighten me what tmux can do for you in this case that people are so excited about it?
评论 #18000098 未加载
评论 #18000194 未加载
评论 #18000087 未加载
epberryover 6 years ago
My tmux conf: <a href="https:&#x2F;&#x2F;github.com&#x2F;EverettBerry&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;ubuntu&#x2F;.tmux.conf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;EverettBerry&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;ubuntu&#x2F;...</a><p>I especially like prefix + &amp; to kill the whole window, prefix + , to rename window, and prefix + &quot;:break-pane&quot; to split the current pane into a new window.
gryfftover 6 years ago
I like to be able to attach to my customary sessions quickly, or reinstantiate them quickly in case of reboot etc.<p>I use something like the following in my .bashrc:<p><pre><code> alias f=&#x27;tmux attach -dt f || tmux new-session -s f&#x27; </code></pre> That way I can recreate or attach to my usual session(s) without even taking my hands off home row.
aydioover 6 years ago
To those who use a tiling window manager: how do you incorporate tmux in your workflow? Since I&#x27;ve mainly used tmux to show multiple terminal sessions at once, I found it to be redundant in a tiling wm environment. But I&#x27;m sure I&#x27;m missing out on other features that my wm cannot provide.
评论 #18000432 未加载
评论 #18000458 未加载
Crash0v3rid3over 6 years ago
Is it possible to have tmux allow mouse scroll in your active window? I always have to press CTRL+B to enable it which is such a pain. This is the only thing that slows me down when using tmux.
评论 #18000219 未加载
blunteover 6 years ago
I probably know about 5% of tmux, but I freaking love it. I&#x27;ve had a tmux session with 12 sub-windows running on a server for 300 days. I connect to it daily, from different machines. It works. It does everything.<p>I have no desktop application that performs at this level. So my hat&#x27;s off to the tmux developers. Like many other great open source tools, it&#x27;s a critical part of my toolset.
cryptonectorover 6 years ago
I do things like:<p><pre><code> - nest tmuxes (up to three levels, with different prefix keys for each level) - one tmux session per workspace (git clone, whatever) - cscope on window zero of any workspace session - use a CSCOPE_EDITOR that starts $EDITOR in a new, appropriately named tmux window in the same session, and returns control to cscope - script the setup of my main session</code></pre>
farresitoover 6 years ago
My biggest complain about tmux is a change they made a few months ago, where they decided to show all the windows by default instead of only showing those in the current session. Even if you filter the sessions to show only those in the current session, it&#x27;s still not the same way it used to be. For that reason, I have stuck with an older version. \rant
JepZover 6 years ago
&gt; You can detach from the Tmux session and return to your normal shell by typing:<p>&gt; Ctrl+a d<p>Looks like someone uses &#x27;Ctrl+a&#x27; as his personal prefix and forgot to replace it in that part of the blog post ;-)<p>Background: I use &#x27;Ctrl+a&#x27; myself (and hate it that tmux uses Ctrl+b by default).
评论 #17999877 未加载
评论 #18002158 未加载
hyperpalliumover 6 years ago
In tmux, is there a way to make the logical screen larger than the physical screen - so you can (1) scroll around to see the whole screen, and (2) view different parts of the logical screen in different terminals?<p>Useful for mobile devices with small screens.
Twirrimover 6 years ago
Might as well take the chance to ask here:<p>Is there a way to get the count of total tmux sessions being run on any machine, for all users?<p>I can do &quot;tmux ls&quot; but that only returns for the current user.
HelloFellowDevsover 6 years ago
Wow conveniently enough I&#x27;ve been trying to get started on a Tmux &amp; Vim environment and I&#x27;ve been running into walls on Tmux related guides.
mark_l_watsonover 6 years ago
That was a really good write up on tmux. I have used tmux for years but use it simply, every few months looking up something on DuckDuckGo as needed.
Insanityover 6 years ago
I only started using tmux like half a year ago, and now it is the first thing I start when opening my terminal.<p>Really improves development with cli tools.
sigjuiceover 6 years ago
My favorite feature is the mouse support, which makes the window names in the status bar clickable, even while logged on remotely.
dnhzover 6 years ago
What&#x27;s everyone&#x27;s preferred tmux prefix key?<p>I use Ctrl-J. So many C-* keys interfere with Emacs &#x2F; readline.
评论 #18002316 未加载
评论 #18001790 未加载
评论 #18001930 未加载
评论 #18002557 未加载
评论 #18002318 未加载
nooberminover 6 years ago
Minor mistake, for detach, it&#x27;s ctrl-b d by default, not ctrl-a d which is screen&#x27;s shortcut.
samgranieriover 6 years ago
I&#x27;ve been using tmux and vim since 2012 and haven&#x27;t looked back. it&#x27;s wonderful!
punnerudover 6 years ago
«tmux a -t 0» &gt; «tmux attach-session -t 0»