1

The Terminal suddenly does not accept commands anymore and basically behaves like a text editor.

enter image description here

The last commands that I put in before this happened was just some nvm commands, i.e. nvm alias default 20.11.0, nvm ls, etc.

Restart did not fix it.

I haven't seen this behaviour before, did I perhaps accidentally hit a shortcut that switched it into a different mode? If so, how do I reset it?

I have Ubuntu 23.10 with all the latest updates, GNOME Terminal Version 3.49.92 for GNOME 45.

Ignatius
  • 133
  • 1
  • 6

2 Answers2

7

As steeldriver said, this is the symptom of a long-running process. Since it is nvm, this is completely reasonable. nvm caused my shell to take significantly longer to start as it tries to load a bunch of files from disk.

Try pressing CTRL+C (multiple times if it doesn't work, then CTRL+\) at that prompt to cancel the long-running command (usually nvm). You should end up at your normal prompt, possibly without color. When Linux runs a terminal command, the terminal subsystem buffers the input and echoes it before sending it to any application, unless the specific command bothered to disable echo.

As Raffa said, the problem is inside ~/.bashrc. See https://github.com/nvm-sh/nvm/issues/782 , https://stackoverflow.com/questions/23556330/run-nvm-use-automatically-every-time-theres-a-nvmrc-file-on-the-directory , and https://github.com/nvm-sh/nvm/issues/1261 . I personally use something like the following edit to my .bashrc:

# Comment out the lines the nvm installer added by default
#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
#[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
#. <(npm completion)

Only load nvm when necessary

alias nvm='unalias nvm && . "$NVM_DIR/nvm.sh" && nvm' alias node='unalias node && . "$NVM_DIR/nvm.sh" && node'

This may cause some subtle bugs, but it greatly reduces the impact of nvm on my terminal startup time. This is especially useful for working with non-Node commands.

Daniel T
  • 4,594
-1

Try booting in single user mode using shortcut ( for me it is ctrl+alt+F4).

Then see if you are able to run commands. If yes, then go to /usr/bin/ and check if gnome-terminal is present. Also check modified date.

First check if internet is reachable and then Try running

sudo apt-get remove gnome-terminal

sudo apt-get install gnome-terminal

to see if it fixes the issue.

If this doesn't work, you can go to ubuntu software and install any other terminal like terminator, guake etc.

IamSushil
  • 114