There are a couple of defaults in the standard Linux shell, bash, that I think need some history brought out. This question is about the prompt.
The default prompt in bash in many Linux distros is [\u@\h \W]\$
For those who can't parse that, it looks like this for a typical user:
[staticsan@walcen files]$ _
The biggest problem with this is that it only tells you the name of the current directory. "files" could just as easily be /var/www/files/
as /home/staticsan/files
(and that's a simple example). A full path makes more sense, so I have to change it every time I setup a new box or create a new user.
So why is the default set to what it is?
A possible answer would be that
would be a very inconvenient for you to work with
The answer is simple — it's a relic of times where terminals were 80 characters wide. Look at your own example — username & host occupies already 16 chars. With additional brackets and spaces there's 20 chars already, and we haven't counted the directory name yet.
And the directories can have pretty long names, too. Your example path counts 21 chars and it's only three directories deep. In such case, on 80-char terminal that prompt will occupy half of the screen width.
Of course, today terminals are wider and that's why many users & distros switch to longer prompts. But there's still some which use a narrower prompt to leave the user more space to type.
I will not answer to the "why" part of the question.
But I'll give you a hint on how to change the default behavior for all of your future user accounts:
You can change the defaults files (and files layout too) use when creating users by changing files in /etc/skel/
So change the PS1 variable in the /etc/skel/.bashrc and it will be the default for new users.
I've gone into my
/etc/skel
and edited the default prompt to the following:it looks like this:
plus color - because I like color :)
But yes - the "why" is related to small terminals, and now a lack of willingness to change from the status quo.
update without color
I like
PS1="\h \d \t \w\n\u > "
which results in:
myserver Mon Sep 07 07:43:11 /u08
root >
So you get hostname, date and time, full path, and then username on a new line, with the prompt. That is to minimize line wrap deep in directories. I'm in and out of boxes all day, so all I can do to keep it straight is good. I also have putty set to log everything. I can go back and look at logs, and see exactly what I was doing when. Also handy for figuring out sequences of events in several terminal windows at once.