在命令提示符中发生奇怪的事情

我在命令行模式下使用Ubuntu,没有GUI。 我是UNIX新手,所以我对刚刚发生的事情感到有些困惑。 我不小心输入了“暂停”而不是“pm-suspend”,我的root~#:提示消失了。 现在,无论我尝试进入什么只是给我一个换行符,按下esc这样的按键给我^ [,箭头键都是^ [^ [[D。 我该怎么做才能返回正常的shell提示符?

suspend是一个bash内置命令,它根据手册页的作用是:

  suspend [-f] Suspend the execution of this shell until it receives a SIGCONT signal. A login shell cannot be suspended; the -f option can be used to override this and force the suspension. The return sta‐ tus is 0 unless the shell is a login shell and -f is not sup‐ plied, or if job control is not enabled. 

因此,您的shell将被暂停,直到您向其发送SIGCONT信号。 您看到的行为是因为shell不解释这些字符。

解决这个问题:

  1. 转到另一个虚拟控制台(按alt-F3或其他)并登录。
  2. 使用pkill将CONT信号发送到名为bash所有进程。 这不会影响其他正在运行的炮弹,但应该“解锁”卡住的炮弹。

    pkill -CONT bash