Terminal not working. Prompt gone!
I've closed the terminal killing a process, after that when opening a new terminal the prompt wasn't there.
After searching online other questions, with CTRL-C y get the prompt back. However, when opening a new terminal the prompt is gone again.
I've tried the following code:
^Cmartin@martin-N550JV:~$
martin@martin-N550JV:~$ ps PID TTY TIME CMD
17626 pts/0 00:00:02 bash
20957 pts/0 00:00:00 ps
martin@martin-N550JV:~$ sudo kill 20957
[sudo] password for martin:
martin@martin-N550JV:~$ sudo kill 17626
martin@martin-N550JV:~$ Taken from this site
I've also uninstalled and then re-installed the terminal, with no success.
Is there a solution for this?
54 Answers
When you open a terminal you get a non-login, interactive shell. If you are using bash the system-wide per-interactive-shell startup file is /etc/bash.bashrc and user-level per-interactive-shell startup file is ~/.bashrc.
The problem you are facing may be due to presence of any bad instruction(s) in any of these two files.
From OP's reply:
sourcing
~/.bashrcinitiate the problem. That means there is problem with~/.bashrc
Possible reasons of disappearing bash prompt:
There might be recursive sourcing that can create an infinite loop type situation. For example if there are lines present in your ~/.bashrc like,
if [ -f ~/.profile ]; then . ~/.profile
fiIt will source ~/.profile. But keep in mind that ~/.profile always sources ~/.bashrc (it is correct way). Hence you are in an infinite loop. Do not source ~/.profile from ~/.bashrc
Under such situation you can not get the prompt unless you hit Ctrl+C
Troubleshooting
You can put a line in your ~/.bashrc
set -xThen you could see that the file descriptor is stopping when you open a terminal.
How to recover
Take backup of ~/.bashrc and get a new one from /etc/skel. Use in terminal,
mv ~/.bashrc ~/bashrc.bkp
cp /etc/skel/.bashrc ~/It will replace your ~/.bashrc with a new one.
Either the problem is like as I expected (described above) or something else should be solved after replacing ~/.bashrc as it is solely related to your ~/.bashrc.
Running this command has solved this problem for me:
reset I was having the issue of non-running, locked lxterminal and a mere $ for the xterm prompt.
I found on my old N600C running Lubuntu 14.04 updated to 16.04, that echo $0 told me I was running /bin/sh instead of /bin/bash.
After that it was just an issue of changing the default shell to /bin/bash in the way that I saw fit for my installation.
There are several ways to do that; they're outside the scope of the OP problem, though.
When I changed back to /bin/bash, it fixed xterm as well as lxterminal, now both show user, host, and pwd.
Likely, the shell prompt has been accidentally customized to be blank.
In a terminal window, do:
sudo cp /etc/bashrc /etc/bashrc.sav
sudo nano /etc/bashrcThen change PS1 to become:
PS1="[\u@\h:\w ] $ "Save, and exit.
The folowing command will show the bashrc files - what do you have?
ls -al /etc/ba* 4