Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Why is PS1 (the console prompt) different for the root user?
Date: Sat, 10 Jun 2017 12:16:59
Message-Id: 0052ac71-f45a-2612-ab58-9011dc294d91@gmail.com
In Reply to: [gentoo-user] Why is PS1 (the console prompt) different for the root user? by Nikos Chantziaras
1 On 10/06/2017 08:12, Nikos Chantziaras wrote:
2 > I noticed that the root prompt does not include the full path of the
3 > current directory. Normal user:
4 >
5 > me@gentoopc ~ $ cd /usr/bin
6 > me@gentoopc /usr/bin $
7 >
8 > However, for root:
9 >
10 > gentoopc ~ # cd /usr/bin
11 > gentoopc bin #
12 >
13 > So for users, I can see where I am ("/usr/bin"). For root, I cannot. It
14 > just says "bin".
15 >
16 > Now, I can change it easily in /etc/bash/bashrc (not sure if that's the
17 > correct place, but it works) by replacing "\W" with "\w". However, I'm
18 > curious as to why "\W" is used for root. When I have several root logins
19 > open (and I usually have to,) it makes it difficult to tell where I am.
20 > It says "bin", but am I in /usr/bin, /usr/local/bin, somewhere else?
21 >
22 > Is there a rationale for this?
23
24 Maybe, maybe not. I have yet to see a distro, OS or sysadmin document
25 anywhere why they have the PS1 they do. Usually, they end up being
26 self-referential: they are that way because that's the way they are, and
27 no-one knows why anymore; it just *is*.
28
29 I have no doubt that whoever first set it up that way had good personal
30 reasons for doing so, but those reasons aren't recorded as far as it can
31 see. I also have no doubt that everyone thereafter didn't have equally
32 good reasons for continuing it (a fancy form of cargo-culting). Follow
33 it all the way through and we come to you and the question you ask :-)
34
35 Feel free to edit PS1 to be anything you want it to be. The prompt is,
36 after all, purely a convenience to make a human's life easier.
37
38
39 --
40 Alan McKinnon
41 alan.mckinnon@×××××.com