Solve your UNIX identity crisis

Contributor Icon Contributed by qmchenry Date Icon March 8, 2004  
Tag Icon Tagged: UNIX

If you frequently login to multiple UNIX systems as different users, it is sometimes helpful to make sure you know who you are. The who command, in addition to telling you who else is online, can tell you who you are logged in as and on what tty port.


To determine who you logged into your current session as in most flavors of UNIX, use the following command:

who -m

As a more memorable alternative, you can use:

who am i

In fact, most versions of who just look for two or more arguments and, if present, generates output equivalent to the -m option. So, the following will probably also work and are a little like primitive Easter eggs:

who is the man
who wants cake
who mom likes

Previous recipe | Next recipe |
 
  • Anonymous
    whoami (all run together) also works.
  • nitro
    > whoami (all run together) also works.

    It's not quite the same. Let me explain:

    "who am i" shows who you are initially logged on as.
    "whoami" shows who you are su'd to.

    For example, if I login as nitro, then su to root, the results are as follows:

    # who am i
    nitro pts/2 Jan 7 09:09

    # whoami
    root
blog comments powered by Disqus