在终端输入空字符 [英] Type null character in terminal

查看:55
本文介绍了在终端输入空字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在终端中键入空字符?

我想做类似的事情:

this is a sentence (null) test123

解决方案

在Linux中,可以通过按 Ctrl + v 紧跟在终端上,从字面上插入任何特殊字符.由实际的符号. null通常是^@,其中^表示 Ctrl ,而@表示在键盘布局上产生 @ 的任意组合.

所以我在键盘上执行: Ctrl + v ,然后是 Ctrl + Shift + @ ,我得到一个带有显着背景色的^@符号.这意味着它是一个特殊字符,而不仅仅是键入^@.

几年后,不同的终端使用键盘布局实现了一些输入变化,这些布局要求按下 Shift 才能访问 @ . /p>

  • Ctrl + v ,然后是 Ctrl + Shift + @
  • Ctrl + v ,然后按 Shift + @ ,释放 Ctrl .
  • Ctrl + Shift + v 后跟 @ ,释放 Ctrl + Shift .
  • Ctrl + Shift 释放 Shift 并再次按 Shift 并保持两个 Ctrl + Shift ,然后按下 v ,最后按下 @ .在某些在 Ctrl + Shift 上实现特殊输入的终端中可以看到.

Is there a way to type the null character in the terminal?

I would like to do something like:

this is a sentence (null) test123

解决方案

In Linux, any special character can be literally inserted on the terminal by pressing Ctrl+v followed by the actual symbol. null is usually ^@ where ^ stands for Ctrl and @ for whatever combination on your keyboard layout that produces @.

So on my keyboard I do: Ctrl+v followed by Ctrl+Shift+@ and I get a ^@ symbol with a distinguished background color. This means it's a special character and not just ^ and @ typed in.

Edit: Several years later and a few input variations implemented by different terminals using keyboard layouts that require pressing Shift to access @.

  • Ctrl+v followed by Ctrl+Shift+@
  • Ctrl+v followed by Shift+@ without releasing Ctrl.
  • Ctrl+Shift+v followed by @ without releasing Ctrl+Shift.
  • Ctrl+Shift release Shift and re-press Shift keeping both Ctrl+Shift pressed followed by v and finally @. Seen in some terminals that implement a special input on Ctrl+Shift.

这篇关于在终端输入空字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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