Linux – -bash-4.2$ for command line

bashcentoscommand linelinuxssh

I don't know why when I SSH with putty onto my VPS, my command line starts with: -bash-4.2$ It hasn't ever been like that, it was myname@localhost

Only thing I have done different in the last 24 hours, was disable root, and create myself a login, rebooted the VPS. I did in fact SSH back onto the VPS after reboot, so I don't know why when I woke up, it's running under bash.

Nothing is changing in bash, so its obvious something isn't right.

-bash-4.2$  cd/
-bash: cd/: No such file or directory
-bash-4.2$ cd //
-bash-4.2$ cd /
-bash-4.2$ cd /var/www/

Best Answer

(edited to add:) The root account is probably using bash also, but it is configured to show your username, hostname, and path in the shell prompt. Shells are very configurable.

The root account presumably had a .bashrc or .profile or similar file which set the shell prompt to the value you expect. (What you're seeing is bash's default prompt.) If you want your new account's shell to have similar behavior, you can look at root's startup files and copy the relevant settings into your new account's startup files. You probably want to copy the setting of the PS1 variable which controls the main interactive shell prompt.

For details, check the PROMPTING section of the bash man page, or the bash reference manual.

Related Question