Read more

Get the initial username which you used to login to your Linux system

Kim Klotz
July 02, 2012Software engineer at makandra GmbH

If you need the initial user which you used to login to your Linux system or the time when you login you can do:

whoami
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

One purpose of this could be the .bashrc to show different Bash Prompts for root to different users:

if [ $(whoami) = "root" ]; then
   PS1='${debian_chroot:+($debian_chroot)}\[\033[41;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
   PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
Posted by Kim Klotz to makandra dev (2012-07-02 14:57)