Hacker News new | past | comments | ask | show | jobs | submit | noloblo's comments login

+1 yes pipes are what shell scripting quite useful and allow for easy composition of the different unix shell utilities


how do you attach to a tmux session via ssh?


Other answers tell you how to attach, but vital missing piece is that beforehand, don't "quit"/"exit" the session but "detach" from it instead, so you can attach later. By default the command is $PREFIX + D


You SSH in and run `tmux attach`


ssh -t -A yourhost.com "tmux attach -d"


tmux a


i use neovim and screen as defaults and find them quite useful, but never found tmux useful, please change my mind tmux what are good starter tutorials?


screen and tmux are similar. Unless you need some of the more obscure features, they mostly do the same things. Screen can attach to a serial port, not sure tmux can (but you can use 'cu' or another utility for that in a tmux window).


In screen, splits and windows behave more like vim buffers and splits. That works nice for an editor because I might want to look at the same file at two different locations. I find it weird to apply that concept to shells.

Tmux panes and windows behave more like separate shells. It's similar to what we get with individual shell gui windows that are neatly stacked and makes it easy to follow.

I don't know if there is an equivalent in screen, but I like and heavily use the zoom feature which can temporarily minimize other splits and focus on single shell.


As tmux can be extended with plugins I'd recommend to check through this list and see if you find something useful:

https://github.com/tmux-plugins/list

As a neovim user I can also very much recommend this vim plugin to seamlessly navigate between tmux panes and neovim windows:

https://github.com/christoomey/vim-tmux-navigator


This is a killer feature IMO. Bind the ctrl-hjkl in vim/neovim for navigation and go between vim panes and tmux panes transparently, beautiful.


> i use neovim and screen as defaults and find them quite useful, but never found tmux useful

Thank heavens there's someone else - I thought I was the only one[1].

[1] I use screen, and then use vim with multiple splits and tabs, with each buffer being a `:terminal`. Works very for me, because I get all the terminals I want, splitted and tabbed in any fashion I want, using my existing vim muscle memory to switch between them, minimise, maximise, etc. Also, takes about 1s to save the session if I ever feel the need to exit vim (I never do, though).


I started with screen and then move to tmux (don't really remember why). I've never been a fan of :terminal. I start and quit Vim multiple times a day (even for the same project) and opening new tmux pane or tab is the reflex for me. I rarely use tabs in vim. My philosophy is that buffers are like sheets of paper on my desk. I rearrange them based on what I want to do. Moving to another tab is like moving to another desk. If I need the terminal for a quick command, I do Ctrl-Z.


I've only used tiling window managers for over a decade, so for me screen is only for detaching, vim usually only one file at a time, and the window manager lets me tile/stack those and the web browser, zoom, etc.


> vim usually only one file at a time,

The big advantage of using a single Vim instance for everything is having all my registers shared.

I can copy something into register 'a' from file One.txt, and then paste 'a' into file Twenty.txt. Same with recording macros, command history, etc.

If any of those buffers are terminals, then I can use them just like a read-only file: copy from them into registers, run macros within them, etc.

The advantage, to me, of using Vim over Tmux, is that that I don't need to remember an additional set of key chords for moving between splits and tabs, and for resizing splits, etc. Using tmux requires additional commands and key chords to memorise.

I used to love tmux before vim had `:terminal`, but since Vim got `:terminal` there's nothing I get from tmux that I don't get in a simpler and easier way from Vim.


If I ever need to copy between instances, I use the + register for the system clipboard. There is only one but generally it's good enough for me.

If I'm expecting a lot of copying between files, that's when I will break my own rule and temporarily use a split window inside vim.


Tmux does the same job as screen.

I didn't want to before, but now in the current year I switched from gnu screen to tmux, keeping the key bindings the same. Ending a 15 year or so streak.

The reason is that tmux supports more modern features like hyperlinks and truecolor, in the distro versions. Once settled, I don't notice a difference.


Can you post your tmux config that mocks GNU Screen?

Here is mine : https://pastebin.com/ZVWYcpyU , but a lot of GNU Screen muscle memory fails for various reasons.

The main reasons I'm trying to switch are: better scrollback support, and better mouse support (both for tmux itself and for pass-through to terminal applications). Having used GNU Screen for 32 years, it's difficult for me to even think about what keys I'm hitting, it's below the level of conscious recognition at this point.


Here is mine - it's pretty short. I think it reflects what I use and don't use, so I'm not sure it's useful to you!

    # remap prefix from 'C-b' to 'C-a'
    unbind C-b
    set-option -g prefix C-a
    bind-key a send-prefix
    bind-key C-n next-window
    bind-key C-p previous-window
    
    unbind C-a
    bind C-a last-window
    
    unbind A
    # Default C-a ,
    bind A command-prompt -I "#W" "rename-window '%%'"
    unbind k
    bind k confirm-before "kill-window"
    
    bind Escape copy-mode
    
    # start counting from 1
    set -g base-index 1
    setw -g pane-base-index 1
    
    # vi keys scrollback
    setw -g mode-keys vi
    
    # Style
    set -g status-bg black
    set -g status-fg white
    
    # Make current tab visible
    setw -g window-status-current-format "#[reverse]*#I:#W*"


How does tmux support hyperlinks?

My virtual terminal (iTerm2, Alacritty) makes mouse-clicking a link opens it in Firefox.

I've used GNU screen for 25 years. I gave tmux a try 10-15 years ago, but I didn't see the upside.

I'm curious about Zellij and its wasm plugins, but equally skeptical.

All I ever do in screen is ^A D, ^A C, ^A SPC, not sure what else I need?


Hyperlinks refers to "OSC 8" which is an escape code for making clickable links. for GNU Screen (released versions in my distro) this is an unknown escape and is stripped, tmux "passes it on" to the surrounding terminal and it is then usable.

Programs such as GNU coreutils ls (ls --hyperlink=always) can use hyperlink escapes in the outputs to make every file name it lists clickable, for example.

Of course there are ways to escape these escapes and get them to pass through screen - I wrote an escape code script myself to do it - but that experience is still inferior to native support, which tmux has nowadays.

Well I used GNU screen for a long time but it finally broke through now due to truecolor, and I managed to switch :)

I tested both zellij and tmux before switching, I was considering zellij as the first alternative. But zellij had some noticeable performance problems compared to tmux when it comes to throughput of terminal output, so I picked tmux.


See Neovim v0.10 changelog for how they use hyperlinks/OSC 8: https://gpanders.com/blog/whats-new-in-neovim-0.10/#hyperlin...


IIRC, iTerm2 has special support for tmux. E.g., tmux panes get corresponding iTerm2 panes?


Tmux lets you make a pane toggle full screen. That’s reason enough for me.



can you paste the relevant /etc/hosts lines


IP addresses might vary depending on geo location or time. Here is what I get from DNS currently, that you can put in your /etc/hosts

51.38.69.52 archive.is archive.today

41.77.143.21 archive.ph archive.li archive.vn archive.fo archive.md

And if all else fails, install Tor and access their site at archiveiya74codqgiixo33q62qlrqtkgmcitqx5u2oeqnmn5bpcbiyd.onion


Tales from inside courtroom 26A in lower Manhattan


bypass paywall : https://archive.ph/5oX5Z


Does anyone else just get stuck in a “I’m not a robot” loop with these links now?


Can you share this example of tracking state of sql with awk?


Sure! I posted a gist here, stripped of anything particular to our company: https://gist.github.com/mplanchard/07229d61bd32ce73624d9003c...




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

Search: