Skip to content
Advertisement

Current path is not showing in terminal for new CentOS user [closed]

I have created a new user on a CentOS server. I don’t know why, but when I connect with this new user the current path is not showing in the terminal. Instead, I can see ‘-bash-4.2’. What is the meaning of -bash-4.2 and how can I display the current path (such as /home)?

enter image description here

Advertisement

Answer

Your current prompt variable ($PS1) contains something like s-v$ which corresponds to the name of the shell and its version. To have the prompt display the current path (along with the trailing $ you currently have), set PS1 with this:

PS1='$PWD$ '

Using either of w or W will produce similar results, except for your home directory.

To keep this setting going forward, you’ll want to set that value in your ~/.bashrc file.

See more options in the bash manual under PROMPTING or online at https://www.gnu.org/savannah-checkouts/gnu/bash/manual/html_node/Controlling-the-Prompt.html#Controlling-the-Prompt

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement