• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • Persistent Sessions

    July 23rd, 2019
    tech, tmux  [html]
    I do most of my work on my laptop, ssh'd into remote machines. Whenever my laptop loses internet I lose my connections. Reconnecting is kind of annoying, because I lose my directory, editor session, environment variables, and any running jobs. For years I've just dealt with this, and tried not to lose my connection, but I finally decided to figure out how to get persistent sessions. I have them set up now, it wasn't that much work, and it's wonderful.

    I run iterm2 with multiple columns. In each column terminal I run:

    $ connect-a
    
    Or b/c/d for the other four columns. This is defined as an alias in my ~/.bashrc:
    $ alias connect-a="ssh desktop -t tmux new-session -A -s a"
    
    This reconnects to the session a, or creates it if it doesn't exist.

    And that's it! It's possible to do all sorts of fancy things with tmux but for the most part I want my local terminal emulator and window manager to do those things instead.

    I now run this in place of ssh desktop, and being able to start a long-running job and then just close my laptop lid is wonderful.

    When I think about why I didn't do this earlier, given how much I like it, it's a tricky question. I tried using screen a few times, and would intentionally use it when starting long running jobs, but it was annoying enough that I didn't want to use it by default. I also had tried tmux, but I'd tried it in its "multiple virtual terminals in a single terminal" mode which isn't as good as a native terminal emulator. I think maybe the main thing was realizing I could name my persistent sessions and associate them with my terminal columns?

    Comment via: facebook

    Recent posts on blogs I like:

    Fireside Friday, November 27, 2020

    Hey folks! Fireside this week. A bit of a change-up in terms of the coming attractions. I had planned to start “Textiles, How Did They Make It?” next, but I want to do a bit more reading on some of the initial stages of textile production (that is, the pr…

    via A Collection of Unmitigated Pedantry November 27, 2020

    Building Depth and Window Space

    How much window space does an apartment need, relative to its area, and how does this affect building style? A fascinating post from about a year ago on Urban Kchoze makes the argument that modern North American buildings are too deep – Simon calls them o…

    via Pedestrian Observations November 27, 2020

    Thoughts you mightn't have thunk about remote meetings

    Welcome to this week's edition of "building a startup in 2020," in which all your meetings are suddenly remote, and you probably weren't prepared for it. I know I wasn't. We started a "fully remote" company back in 2019, but …

    via apenwarr November 23, 2020

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact