Command prompt colours

Here’s an old trick which works great on ESX servers (thanks to this article on Linux Journal for reminding me). It turns your prompt different colours to highlight when you are logged in as root.
To make the prompt red when you’re running as root add this to /root/.bashrc:
PS1=’\[\e[31m\]\u@\h:\w#\[\e[m\] ‘
To make the prompt green when running as a normal user add this to ~/.bashrc:
PS1=’\[\e[32m\]\u@\h:\w\$\[\e[m\] ‘
Update: If you want to add this to a kickstart script, do this:
# Help identify when logged in as root
echo “PS1=’\[\e[31m\]\u@\h:\w#\[\e[m\]‘” >> /root/.bashrc
echo “PS1=’\[\e[32m\]\u@\h:\w#\[\e[m\]‘” >> /etc/skel/.bashrc
One Response to Command prompt colours
Leave a Reply Cancel reply
Forbes Guthrie
Recent Posts
- Small update to the Reference Card
- Minor update to the vSphere 5 Reference Card
- vSphere 5 vReference Card released
- Cisco UCS boot from iSCSI SAN – ESXi design consideration
- vSphere 5 vReference card – Storage section
- Does 2008 R2 Failover Clustering require a change to the Notify Switches policy?
- vSphere 5 vReference card – Host section
- vSphere 5 vReference card – Install section
- Auto Deploy design concern
- vSphere 5 vReference card – vCenter section
Recent Comments
- honglus on How to PXE boot from your trunked vmnic0
- Sunmeet on Understanding ESXi – stateless, diskless, feckless
- Forbes Guthrie on vSphere 5 Card
- Forbes Guthrie on vSphere 5 Card
- Jakk on vSphere 5 Card
- Purushothama S on vSphere 5 notes
- Bjorn on vSphere 5 Card
- Chris on Minor update to the vSphere 5 Reference Card
- Michael Webster on Auto Deploy design concern
- Ankur Maheshwari on vSphere 5 notes
Twitter
- As much as I've become an NFS supporter over the years, VMFS5 & ATS is really making me like iSCSI & its better multipathing. : 2 weeks ago
- @__wintertale__ Hi Iona (& Lesley). Welcome to the twitterverse from a cloudy and wet Vancouver. How's the coffee? : 3 weeks ago
- RT @jtroyer: ... Kaua'i http://t.co/s4Ovo4jD << Staying in same resort next month. Pls, no destroying it with wild parties ;) : 3 weeks ago
- RT @dobaer: @forbesguthrie How was the run in your shiny new shoes? << Nice, the trails around Vancouver are stunning. : 3 weeks ago
- @h0bbel I'm a Salomon addict, but I'm scared to get these ones muddy :) : 3 weeks ago
- Just took my pwutty new #salomon trail shoes for an hour's run in Pacific Spirit Park. http://t.co/7dAQDXgl : 3 weeks ago
- RT @alim__k: @forbesguthrie @keith_aasen look at you guys, figuring this out over social media ;-) < that's where I do all my best designs : 3 weeks ago
- @keith_aasen Great, just what I was after. And presumably one per controller to prevent performance degradation on failover (after refill) : 3 weeks ago
- @keith_aasen You're the VDI sizing TR author :) You're my Guru! : 3 weeks ago
- NetApp gurus: VDI on 3170 - where's FlashCache watershed for 2x 512GB to 4. When is it 2TB not 1TB? Don't say "it depends" /cc @keith_aasen : 3 weeks ago






This is a nice tip, just gives you a heads up with out much thought as to where you are and the potential for your cmd line inputs. not to mention, quicker admins make more money, lol… wait, what?