This is my current prompt.
How do I get it to just show the current directory?
I think I need to add a PS1 to my .bashrc.
Like this.
~/Documents$
andy@andy-To-be-filled-by-O-E-M:~$
This is my current prompt.
How do I get it to just show the current directory?
I think I need to add a PS1 to my .bashrc.
Like this.
~/Documents$
andy@andy-To-be-filled-by-O-E-M:~$
100% correct
This is the part that should be in your .bashrc
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
Depending on your settings it shows the prompt either with or without color.
You can reset your complete .bashrc to "factory settings" by issuing this command:
cp /etc/skel/.bashrc "$HOME"/.bashrc
What you posted was in my "factory settings" and the prompt is still the same.
Could it be that you are running 'sh' instead of 'bash' ?
the command echo $SHELL
should return /bin/bash
Try to create a new user and see if you get the right prompt as that user
If you do get the right prompt as that new user, it means that you have some script, setting or autostart entry resetting your PS1 prompt .
If not, then I'm out of ideas at the moment.
Hi, @fixit7
If what you want is that your prompt shows as:
~/Documents$
... instead of appearing as:
andy@andy-To-be-filled-by-O-E-M:~/Documents$
... then I believe you have to do a variation of @tkn's excellent suggestion. Namely, you should add the following lines to your .bashrc
:
if [ "$color_prompt" = yes ]; then
PS1='\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='\w\$ '
fi
unset color_prompt force_color_prompt
I hope this helps
I did so and got this
~$
Hi again, @fixit7
You wrote:
Well, that prompt probably means that you are in the ~/
directory and not in the ~/Documents
directory. Please, start by issuing the following command:
cd ~/Documents
... and after writing that command (and pressing ENTER) then please see what the prompt for the following command looks like. It should look like the following:
~/Documents$
Am I right?
Thanks ricmarques.
My mistake. I did not know I was in my root directory.
I made an alias called hm gets me to the root directory.