Windows 中的 Ubuntu 终端?谁能解释一下“col”?给我用简单的英语命令?

发布于 2024-10-02 08:13:14 字数 389 浏览 2 评论 0原文

下周我将接受有关在 Ubuntu 中使用终端使用基本命令和 shell 脚本编写的考试。请帮我解决两个简单的问题:

- 有 Ubuntu 终端的练习环境吗?我不想与 Linux 双重启动,所以我想找个地方可以练习使用一些基本的终端命令,因为 Cygwin 似乎与 ubuntu 终端有很大不同。

-Linux 中的 col 命令有什么作用?手册页在这里:链接,但我发现很难理解,并且由于它在 Cygwin 中不起作用,因此很难解释!另外,为什么要使用 man 管道连接到 col -b -x ?

非常感谢您,并对可能愚蠢的问题表示歉意!

Next week I am getting an exam on using basic commands and shell scripting using terminal in Ubuntu. Please help me out with two quick questions:

-Does a practice environment for the Ubuntu terminal exist? I don't want to dual boot with Linux, so I want to find somewhere I could practice using some basic terminal commands as Cygwin seems to be quite different from the ubuntu terminal.

-What does the col command in Linux do? The manual page is here: Link, but I find that hard to understand, and since it doesn't work in Cygwin, it's hard to interpret! Also, why would one use man piped to col -b -x?

Thank you very much and sorry for the probably silly questions!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清风夜微凉 2024-10-09 08:13:14

您可以使用 Ubuntu LiveCD 启动(启动 Ubuntu 系统而不实际安装它)并尝试使用 Ubuntu 终端 shell。它实际上与标准 Ubuntu 安装 CD 相同...您只需在启动后选择“尝试 Ubuntu”而不是“安装 Ubuntu”:
https://help.ubuntu.com/community/LiveCD

col 是过滤掉的程序文本输入中的反向换行(即退格字符)。在过去的行式打印机中,实现粗体打印的常见方法是打印一个字符,然后打印一个退格字符,然后再次打印该字符。这将使打印机在同一位置敲击字符两次。有些程序会发出以这种方式格式化的文本文件(man 就是一个这样的程序)——但是如果您随后尝试将该文本文件显示到终端屏幕上,您最终可能会看到如下内容: “这是 b^Hbo^Hol^Hld^Hd 文本”。

col -b 只是过滤文本输入以去除那些额外的退格和双击字符。 -x 选项将制表符转换为空格字符,如果输出针对具有特定制表符宽度的设备进行格式化,但随后显示在不同的设备上,则这可能很有用。

手册页中通常嵌入退格/双键文本,因此将 man 通过管道传输到 col 通常很有用。

如今,大多数终端模拟器实际上都知道如何处理退格键/双击键,因此 col 的使用不多。

You can use the Ubuntu LiveCD boot (boots up an Ubuntu system without actually installing it) and experiment with the Ubuntu terminal shell. Its actually the same CD as the standard Ubuntu installtion CD... you just chose "Try Ubuntu" instead of "Install Ubuntu" once it boots up:
https://help.ubuntu.com/community/LiveCD

col is program to filter out reverse-linefeeds (i.e. the backspace character) from text input. In the olden days of line printers, a common method to achieve boldface print was to print a character, then print a backspace character, then print the character again. This would make the printer strike the character twice in the same place. Some programs would emit text files formatted in this way (man is one such program)-- but if you then tried to display that text file to your terminal screen, you might end up seeing something like this: "here is b^Hbo^Hol^Hld^Hd text".

col -b simply filters text input to strip out those extra backspace and double-strike characters. The -x option converts tab characters to space characters, which might be useful if the output was formatted for a device with a particular tab width, but then displayed on a different device.

man pages often have the backspace/double-strike text embedded in them, so man piped into col was often useful.

Nowadays, most terminal emulators actually know how to handle the backspace/double-strike, so col doesn't get used as much.

把回忆走一遍 2024-10-09 08:13:14

http: 比 Cygwin 更好(更容易使用、安装、维护等),并且可能比虚拟机占用更少的资源。 //andlinux.org 。这将为您的 Windows 桌面提供一个 shell,您可以使用 col 命令来更好地理解它。

Far better (easier to use, install, maintain, etc.) than Cygwin, and perhaps less resource-using than a virtual machine, is http://andlinux.org . That will give you a shell on your Windows desktop, and you can play with the col command to better understand it.

我三岁 2024-10-09 08:13:14
  • Win-bash 本质上与 Linux 相同,但在 Windows 上。您可以使用它在 Linux 之外进行实验,但我不确定它的效果如何。
    其他选项是虚拟机,如果您不介意重新启动,您可以使用 wubi 安装 ubuntu,这意味着使用完毕后可以从 Windows 的添加/删除程序中将其删除。 (或者只使用 live 光盘)
  • Col 对于大多数人来说用途非常有限,它只影响异步写入行而不是逐行写入的程序......
  • Win-bash is essentially the same shell as linux, but on windows. You can use this to experiment outside Linux but I'm not sure how effective it is.
    Other options are virtual machines, and if you don't mind a reboot, you can install ubuntu with wubi which means it can be deleted from windows' add/remove programs when you are done with it. (Or just use the live disc)
  • Col has very limited use for most people, it only affects programs that write lines asynchronously as opposed to line by line...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文