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 UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
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)