Linux学习笔记:终端删除键失效解决办法
一、删除键变空格
近日在安装 vi
时遇到报错,遂卸载了部分包进行重新安装。
安装后出现终端乱序,输错命令按 Backspace
删除键进行删除时不能删除反而添加空格,并且导致某些快捷键无法使用。
经过一番查找发现:
终端所依赖的包 ncurses-base
被删除,安装后重新输入 bash
即可解决。
sudo apt install ncurses-base
root@1021d8f88470:/data# apt install ncurses-base
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
ncurses-base
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 238 kB of archives.
After this operation, 348 kB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/debian stretch/main amd64 ncurses-base all 6.0+20161126-1+deb9u2 [238 kB]
Fetched 238 kB in 0s (679 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package ncurses-base.
(Reading database ... 25176 files and directories currently installed.)
Preparing to unpack .../ncurses-base_6.0+20161126-1+deb9u2_all.deb ...
Unpacking ncurses-base (6.0+20161126-1+deb9u2) ...
Setting up ncurses-base (6.0+20161126-1+deb9u2) ...
root@1021d8f88470:/data# bash
二、删除键变^H
执行删除时,无法删除,后面显示 ^H
。
解决办法:
- 方法一:
Ctrl + Backspace
进行删除,较为麻烦 - 方法二:在终端执行
stty erase ^H
,再进行删除即可。
参考链接:linux 删除变为空格