How do I copy text from my xterm without a mouse?

后端 未结 6 1565
夕颜
夕颜 2021-01-30 05:27

I want to use part of the output of a command run from the command line in another xterm, or as part of a different command. For instance:

> grep error err         


        
6条回答
  •  一个人的身影
    2021-01-30 05:53

    Easiest way would be using byobu which uses either tmux or screen in the background. It's a wrapper tool that makes using screen or tmux way more efficient, fast and easy. As such it makes it very simple to copy n paste too.
    Once you're in byobu and you have the output you want to copy, you can do the following to copy and then paste it:

    1. Enter in scroll mode by pressing F7. This mode allows to scroll up and down with arrow keys or PageUp and PageDown keys both in the output of previous commands or in the body of a text editor.
    2. Move the cursor with the arrow keys to the point where u want to start copying.
    3. Press and release Space bar.
    4. Move the cursor to select the text/region to copy (this looks very similar to vim VISUAL mode)
    5. Copy by pressing Enter (this will immediately exit you from scroll mode and copy mode)
    6. You can now paste using Alt + Insert (only within byobu by default but u can extend the paste enabled applications by installing xclip and doing some setting in byobu --> watch Introduction to terminal multiplexers - Part 2 from around minute 42 to 48)

提交回复
热议问题