- whoami invocation (GNU Coreutils 9.1)
- coreutils/whoami.c at master · coreutils/coreutils (github.com)
20.3 whoami: Print effective user name
whoami
prints the user name associated with the current effective user ID. It is equivalent to the command ‘id -un’.
The only options are –help and –version. See Common options.
An exit status of zero indicates success, and a nonzero value indicates failure.
ตัวอย่างคำสั่ง
$ whoami jack
$ sudo whoami root
คำสั่ง whoami
มี options แค่ --help
และ --version
$ 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 GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Full documentation at: <https://www.gnu.org/software/coreutils/whoami> or available locally via: info '(coreutils) whoami invocation'
$ whoami --version whoami (GNU coreutils) 8.30 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://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.
Note: คำสั่ง whoami
จะได้ผลเหมือนกับคำสั่ง id -un
$ id -un jack