On 10/06/2017 08:12, Nikos Chantziaras wrote:
> I noticed that the root prompt does not include the full path of the
> current directory. Normal user:
>
> me@gentoopc ~ $ cd /usr/bin
> me@gentoopc /usr/bin $
>
> However, for root:
>
> gentoopc ~ # cd /usr/bin
> gentoopc bin #
>
> So for users, I can see where I am ("/usr/bin"). For root, I cannot. It
> just says "bin".
>
> Now, I can change it easily in /etc/bash/bashrc (not sure if that's the
> correct place, but it works) by replacing "\W" with "\w". However, I'm
> curious as to why "\W" is used for root. When I have several root logins
> open (and I usually have to,) it makes it difficult to tell where I am.
> It says "bin", but am I in /usr/bin, /usr/local/bin, somewhere else?
>
> Is there a rationale for this?
Maybe, maybe not. I have yet to see a distro, OS or sysadmin document
anywhere why they have the PS1 they do. Usually, they end up being
self-referential: they are that way because that's the way they are, and
no-one knows why anymore; it just *is*.
I have no doubt that whoever first set it up that way had good personal
reasons for doing so, but those reasons aren't recorded as far as it can
see. I also have no doubt that everyone thereafter didn't have equally
good reasons for continuing it (a fancy form of cargo-culting). Follow
it all the way through and we come to you and the question you ask :-)
Feel free to edit PS1 to be anything you want it to be. The prompt is,
after all, purely a convenience to make a human's life easier.
--
Alan McKinnon
[email protected]