WHOAMI(1) COMMAND REFERENCE WHOAMI(1) NAME whoami - print effective current user ID SYNOPSIS whoami DESCRIPTION Whoami prints the effective user ID which is running the current process. This is different from who am i, which prints the name of the person logged in on the tty. EXAMPLES The following shell script fragment prevents the user ID root from executing the command: #!/bin/sh if test 'root' = "`whoami`" then echo "This shell script may not be run by 'root'." exit 1 fi ... FILES /etc/passwd Name data base. RETURN VALUE [NO_ERRS] Command completed without error. [NP_ERR] An error occurred that was not a system error. Execution terminated. CAVEATS The user ID returned corresponds to who you are at that point in time. So if you have used su to substitute another username, that name is returned. SEE ALSO who(1n) and su(1). Printed 5/12/88 1
%%index%% na:288,92; sy:380,162; de:542,454; ex:996,387; fi:1383,123; rv:1506,288; ca:1794,265; se:2059,131; %%index%%000000000132