Live data from Hacker News

Keyboard shortcuts for GNU Readline

masteringemacs.org

171–174 of 174 posts

Re: Keyboard shortcuts for GNU Readline

#171
post #166
post #161

Earlier quoted context omitted.

Yes please. Teach me how to copy output of previous command into clipboard using keyboard only and I will love you forever. Bonus if I can have a cursor to only select partial lines of the output.

You can pipe to xclip to get it into the copy buffer. Then "shift-insert" is often the right paste when "ctrl-v" doesn't work.

Thanks for tip, but quite far from ideal. Piping into something requires 1. knowing upfront I want to copy the output. 2. Doesn’t allow partial selection of the output. 3. Extra typing | xclip after every command. 4. Xclip is not installed by default.

Re: Keyboard shortcuts for GNU Readline

#172
post #167

Earlier quoted context omitted.

a really cool hack I found in an HN thread long ago was to stick "hashtags" (aka bash end-of-line comments) at the ends of commands you want to find in your history quickly: sudo systemctl restart myservice #bounce and then ctrl-r and type your hashtag to get right to it

This is now the HN thread in which I found this really cool hack. Thank you.

I'm officially naming these "bashtags".

Re: Keyboard shortcuts for GNU Readline

#173
post #12

Earlier quoted context omitted.

That's useful, but C-r has its merits too, as you can search for any string in the history. So, even if you run, say, python programs all day, here's a way to find that one time you used a different command line parameter... etc.

You can set bindings for substring search too: "\e[A":history-substring-search-backward "\e[B":history-substring-search-forward

Cool!

Re: Keyboard shortcuts for GNU Readline

#174
post #161
post #24

Earlier quoted context omitted.

Not at all. bash readline is probably the productivity enhancer skill a developer (or system admin) can develop. Simple things like copy and paste without hitting a mouse. This will make you _prefer_ the cli as it is not slowing you down anymore.

Yes please. Teach me how to copy output of previous command into clipboard using keyboard only and I will love you forever. Bonus if I can have a cursor to only select partial lines of the output.

Many terminals have a different mode, where you can navigate and copy everything displayed in the terminal. Alacritty can do this, for example.
Post reply on HN