whoamiは、現在の有効なユーザーIDに関連付けられたユーザー名を出力するLinux/Unixコマンドです。これは、RichardMlynarikとGNUCoreutilsの一部によって書かれています。
完全なドキュメントについては、次のコマンドを実行してください:infocoreutils「whoamiinvocation」
構文
whoami [OPTION]...
オプション
–help:- Print help –version:- Display version information
whoamiコマンドは、複数のインスタンスで作業しているDBA /管理者が、ログインしている現在のユーザー名を知るのに役立ちます。シェルプロンプトでコマンドを入力するだけで、以下に示すように現在のユーザー名が表示されます。
$ whoami atech
外部コマンドです。実行可能ファイルの場所は/usr/binです。以下に示すように、type-aコマンドを使用して見つけることができます。
$ type -a whoami whoami is /usr/bin/whoami
その他の例については、以下を確認してください
1。ユーザー名を印刷する
以下に示すように、オプション/パラメータなしでコマンドを入力するだけで、現在のユーザーIDのユーザー名が表示されます。
$ whoami atech
2。ヘルプを表示
–helpオプションは、whoamiとexitに関するヘルプを表示します
$ whoami --help Usage: whoami [OPTION]... Print the user name associated with the current effective user ID. Same as id -un. --help display this help and exit --version output version information and exit Report whoami bugs to [email protected] GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> For complete documentation, run: info coreutils 'whoami invocation'
3。印刷版
–versionは、バージョン情報を表示して終了します
$ whoami --version whoami (GNU coreutils) 8.4 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Richard Mlynarik.