logname

Print the name of the current terminal login user.

Summary

logname [OPTION]...

The main purpose

Options

--help Display help information and exit.
--version Display version information and exit.

return value

Returning 0 indicates success, returning a non-zero value indicates failure.

example

[root@localhost ~]# logname
root

Notice

  1. Pay attention to distinguishing the two commands whoami and logname; for example, we opened the terminal as user root and then switched to user user2. At this time, whoami returns the current user user2, and logname returns root. You can verify it by yourself.

  2. This command is a command in the GNU coreutils package. For related help information, please see man -s 1 logname, info coreutils 'logname invocation'.

继续阅读

接下来你可能需要这些内容

优先推荐相关内容,同时保留你的阅读轨迹和收藏入口。