Linux – Who decided the default shell prompts in Linux

bashlinuxprompt

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?

Best Answer

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.