I'm using Debian and today I typed:
in my terminal and somehow the
user@xxx changed to
How do I get back the
user@xxx? I think it's better for me because for example it shows the path to my current folder etc...
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
exec bash -l
This will replace the current shell session with a
bash shell started as a login shell. A login shell will read your
.profile, whichever it finds first) and other files where your prompt may be defined.
exec bash, you replaced the current shell session with an interactive shell. This will read
.bashrc from your home directory. If you don't set your prompt there, then you will get the default
exec, you would have been able to just
exit to get back to your old shell session. With the
exec, the old session is now gone.
You may also simply exit the shell and start a new one.
user@xxx is called the "prompt". It is set by the
PS1 environment variable. In bash, it defaults to
bash-<version> which is utterly useless, but in principle a bash configuration file should always set it to something better.
A common case where you would get this is when you just created a
~/.bashrc file that does not include
/etc/profile. Without this file, bash was falling back to
/etc/profile and you were getting your system's default configuration. With an empty or minimalist
~/.bashrc, only your own configuration is loaded, and you don't get the benefit of what your distro or your sysadmin put in
Solution: add this to your
if [ -f /etc/profile ]; then . /etc/profile fi
Alternatively, set your prompt yourself by adding something like this (after the snippet above):
(You can customize what appears in the prompt, make it colorful & all with tools like http://ezprompt.net/)