Hacker News new | ask | show | jobs
by sandworm101 3666 days ago
> Turn on Quick Edit. Now drag to select and right click to copy.

Command line + mouse = GUI, not command line.

2 comments

Then turn on "Extended text selection keys" and you can use shift with arrows to select and ctl-c to copy.
I'm curious, how do you copy and paste in Bash without a GUI?
Let's say you want to copy and paste something from an earlier command line entry and put it in a new command line entry:

  % set -o vi
  % # hit ESC to go into vi cmd mode, hit k a few times until
  % # you get to this old command in your command history:
  % longasscommand -with -params -i super.dont -w ant2 -type in -again
  % # you want just the stuff from -params to ant2, so you
  % # type "f-n" to get the cursor to -params, then "yf2"
  % # to copy everything from there to -w ant2
  % # now you type j a couple times to go back down to
  % # the line you were working on:
  % longasscommand -with -oh jesus -not this.shit -again
  % # now you hit "f-nn" to put the cursor on the -not
  % # type "dW." to get it just so:
  % longasscommand -with -oh jesus -again
  % # now you're ready to paste in your copy after jesus
  % # so you type p, and it's inserted where you left the cursor:
  % longasscommand -with -oh jesus -params -i super.dont -w ant2 -again
You can use screen or tmux to copy and paste from anything on the screen, including using the mouse. It's really out of the purview of bash, tho.

Really handy tools on the Mac are pbpaste which sends any text in the system clipboard to stdout and pbcopy, which you can prolly guess at.

>set -o vi

I don't know how I lived without knowing that this is a thing.

It's not about GUI, but about not using mouse.
You don't need a mouse for the Windows command prompt. You just need to turn on an extra option. I don't see the problem here.
Ok then, how do you copy and paste without using a mouse in Bash?

Edit: this is in reply to the comment at the same level of this one, can't hit reply on it

can't hit reply on it

There's an anti-flamefest delay on comment threads: you can't reply to comments younger than a few (5?) minutes. However, if you go to the comment directly (click on the timestamp next to it), you do get the option to reply immediately.