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

后端 未结 6 1560
夕颜
夕颜 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:57

    You can use GNU screen's copy and paste commands.

    Quick tutorial:

    1. Open screen: screen (or screen myprog my args here)
    2. Run your program, producing output you want copied
    3. Enter copy mode: Control+a+[
    4. Move your cursor to the start point
    5. Hit Enter
    6. Move your cursor to the end point
    7. Hit Enter
    8. Paste: Control+a+]

    Screen is much more powerful than that (I use it to tab several virtual terminals without the need for a special terminal emulator, and also so that I don't loose my sessions when X crashes or something). To get out of screen, simply end your shell session, or type Ctrl+a, Ctrl+\.

提交回复
热议问题