Posted about 5 years ago. Visible to the public.

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

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

Copy
who -m

If you're in a good mood you can also do:

Copy
who am i

or (this is my favorite):

Copy
who mom likes

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

Copy
if [ `who mom likes | awk '{print $1}'` = "foobar" ]; 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

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Author of this card:

Avatar
Kim Jahn
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Kim Jahn to makandropedia