简体   繁体   English

为什么当我在`/ usr / local / bin`中捕获节点目录时,它是否释放了cthulhu?

[英]Why when I cat the node directory in `/usr/local/bin` does it unleash cthulhu?

So I was installing node and somehow I ended up in the /user/local/bin folder checking what was there. 所以我正在安装节点,不知怎的,我最终在/user/local/bin文件夹中检查那里有什么。

I wanted to so a ls | grep node 我想要这样一个ls | grep node ls | grep node but did a ls | cat node ls | grep node但做了一个ls | cat node ls | cat node . ls | cat node The node directory then started to show itself in all its glory. 节点目录然后开始显示它自己的所有荣耀。 I chuckled, laughed, then stopped the cat but that left my terminal looking something like this: 我笑了,笑了,然后停了cat ,但留下我的终端看起来像这样:

在此输入图像描述

It is easily fixable by exiting the window. 退出窗户很容易解决。

I don't recommend you try it but i've managed to recreate it reliably. 我不建议你试试,但我设法可靠地重新创建它。 Just cat the node directory leave it for a few seconds then cancel it. 只需cat节点目录离开它几秒钟然后取消它。

My question is what on earth is going on here? 我的问题是这里究竟发生了什么? AFAIK using cat shouldn't be able to make this stuff happen. 使用cat AFAIK不应该让这个东西发生。

Terminals interpret certain combinations of bytes as commands. 终端将某些字节组合解释为命令。 This is how command line programs can output colors, or change the cursor position. 这是命令行程序可以输出颜色或更改光标位置的方式。 What you're seeing is the output after one of these commands activated a box drawing character set by accident. 你看到的是这些命令之一意外激活了一个盒子绘图字符集后的输出。 You can activate it yourself with echo or printf : 您可以使用echoprintf激活它:

my cool prompt$ printf '\033(0'
└≤ ␌⎺⎺┌ ⎻⎼⎺└⎻├$

To get out of this mess, type reset and press Enter - it will clear the screen and set all settings back to default. 要摆脱这种混乱,请键入reset并按Enter键 - 它将清除屏幕并将所有设置恢复为默认值。

└≤ ␌⎺⎺┌ ⎻⎼⎺└⎻├$ ⎼␊⎽␊├

(..screen clears..)

my cool prompt$

You managed to output the contents of the node executable to the terminal. 您设法将node可执行文件的内容输出到终端。 What happens when you output random octets to the terminal depends on what those characters are and on the terminal. 将随机八位字节输出到终端时会发生什么情况取决于这些字符在终端上的位置。 It often leaves the terminal in a state that the user did not really expect. 它经常使终端处于用户并不真正期望的状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 / usr / bin / env:“节点”:运行vscode任务时,没有这样的文件或目录 - /usr/bin/env: ‘node’: No such file or directory when running vscode task 我如何读取/ usr / local / bin / node二进制文件? - how do i read the /usr/local/bin/node binary? 从 /usr/local/bin/node 卸载节点 - Uninstall node from /usr/local/bin/node /usr/local/bin/node:当我尝试在 freebsd 中运行节点时,未定义符号“nghttp2_option_set_max_settings”错误 - /usr/local/bin/node: Undefined symbol “nghttp2_option_set_max_settings” erro when i try to run node in freebsd -bash: /usr/local/bin/npm: 没有那个文件或目录 - -bash: /usr/local/bin/npm: No such file or directory 命令 node -v 显示 bash: /usr/local/bin/node: No such file or directory - Command node -v shows bash: /usr/local/bin/node: No such file or directory Gulp: /usr/local/bin/gulp: 没有那个文件或目录 - Gulp: /usr/local/bin/gulp: No such file or directory / usr / bin / env:节点--harmony:没有这样的文件或目录 - /usr/bin/env: node --harmony: No such file or directory Jenkins - /usr/bin/env: 节点:没有这样的文件或目录 - Jenkins - /usr/bin/env: node: No such file or directory Angular:bash: /usr/local/lib/node_modules/@angular/cli/bin/ng: 没有这样的文件或目录 - Angular:bash: /usr/local/lib/node_modules/@angular/cli/bin/ng: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM