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 ~/.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
.
source ~/.bashrc
?source ~/.bashrc
your prompt is going away or not? it will not solve your issue it is just a troubleshooting step.xterm
orxfce4-terminal
?