# Ubuntu – Terminal not working. Prompt gone!

command line

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?

• 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.

sourcing ~/.bashrc initiate 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
fi


It 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 -x


Then 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.