Home > Software design >  copy text from the output of a previous command (using only keyboard, not mouse)
copy text from the output of a previous command (using only keyboard, not mouse)

Time:12-15

How can I copy text from a previous command's output in bash using only keyboard (not mouse)

$ ./my_lovely_program input.txt
eggs
sugar
flour
$ <----- any way to move "up" and yank / copy the word "sugar" ?

CodePudding user response:

Once something is printed, it is gone, and bash does not know anything about it anymore. bash can intercept your keystrokes, but does not have stored anywhere the previous output. The best you could do is to use tee:

./my_lovely_program input.txt | tee some_file

where some_file would contain the standard output of your program.

  • Related