Skip to content

whoami ​

whoami returns the real name (not the login) of the process owner, e.g. "Ada Lovelace" rather than "ada".

Signaturewhoami(): string?
tyrus
import { whoami } from "tyrus:os";

const realName: string? = whoami();
if (realName) {
    print(`hello, ${realName}`);
}

Absence is a valid outcome

Returns absent (not an aborted program) if the operating system has no real name set for the account, e.g. no GECOS field, or a platform where a real name is not a distinct concept from the login.

See also userName and userInfo, which return the login name.