[英]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
: 您可以使用
echo
或printf
激活它:
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.