• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Why Does Linux Prompt Look Like ...

Rubicone

Senior member
Last night I was practicing adding users using the passwd and shadow file. Used the passwd command to create a password for the new user. Made a home directory for the new user. Copied the default login initialization files to the users home directory.Assigned the appropriate permissions for the home directory and contents.Set the owner and group for these directories. However, when I attempted to login as that user I got the following strange looking prompt.
bash-2.05$.
Can anyone tell me why that is and how it can be changed?

 
Nothing strange looking about that, it's a regular bash prompt.

What exactly were you expecting?

Oh and a tip, instead of creating userdirs and such yourself, you just use useradd -m -d /home/username -s /whatever/shell.
The -m option will create the dir and copy the files from /etc/skel into it.
 
I know about the useradd command but I am trying to learn this other method as I will be tested on it for a course on Linux I am taking. In terms of what I expected it is as follows:

[rubicone@sob3 skel]$

The username, preceding the computer name of the server, and the directory name one is currently in.

I looked at the .bash_profile file and the contents thereof are as follows:

[rubicone@sob3 skel]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc

The contents of the .bashrc file are as follows:

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi


fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

Is there something missing in either one?
 
Type set, and see what the PS1 var is set to.

If you want a "username@hostname wd", type PS1='\u@\h:\w$ '.
\u = username
\h = hostname
\w = working directory
 
Is everything enclosed in single quotations? Cannot quite make out the full command because of the font and size thereof.
 
Yup, but it should work with double quotations as well, I just tend to stick to singles.

Oh and by the way, to make it stick, put it in the users .bashrc file.
Or to make it system-wide, put it in the /etc/profile.
Or if you just wanna make it the default for newly created accounts, edit the /etc/skel/.bashrc file.
 
Not as long as you dont break something else.

Such as putting it smack in the middle of an if/fi statement or something.
 
A fi is the closing statement for an if.

if
blah blah is tru
do blah blah
fi

PS1='Whateveryouwant'

if
more blah
fi
 
Back
Top