如何在没有鼠标的情况下从我的xterm复制文本? [英] How do I copy text from my xterm without a mouse?

查看:306
本文介绍了如何在没有鼠标的情况下从我的xterm复制文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用从另一个xterm中的命令行运行的命令的输出的一部分,或者作为不同命令的一部分。例如:

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 error.log
error: can't find file ~/<some very long path>/thisfile

我想这样做:

>ls ~/<some very long path>/

我知道两种方法:

1. copy 〜/<一些很长的路径> /

2.使用 head / tail / awk / sed / perl / cut / etc ...仅从输出中提取所需内容,然后使用 >里面的反引号。

I know two ways to do this:
1. copy ~/<some very long path>/ with the mouse.
2. use some combination of head/tail/awk/sed/perl/cut/etc... to extract only what I need from the output and then use that inside backticks.

有没有办法在不使用鼠标的情况下复制文本?我想到的例子是VIM中的视觉模式,但我不知道如何在xterm里面做。

Is there any way to copy text without using the mouse? The example that comes to mind is visual mode inside VIM, but I don't know how to do that inside the xterm.

推荐答案

您可以使用GNU屏幕的复制和粘贴命令。

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

快速教程:


  1. 打开屏幕: screen (或 screen myprog my args here


  2. 将光标移动到起点
  3. $ <$ li>
  4. 输入复制模式: b $ b
  5. 输入

  6. 将光标移至结束点

  7. 粘贴:^ A]

  1. Open screen: screen (or screen myprog my args here)
  2. Run your program, producing output you want copied
  3. Enter copy mode: ^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: ^A ]

屏幕功能强大得多(我使用它来标记多个虚拟终端,终端仿真器,并且也使得我不松开我的会话,当X崩溃或某事)。要退出屏幕,只需结束shell会话,或键入^ 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 ^A ^.

这篇关于如何在没有鼠标的情况下从我的xterm复制文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆