On Unix-like operating systems, the logname command prints the login name of the current user.

This page covers the GNU/Linux version of logname.

Syntax

logname [OPTION]

Options

Examples

logname

Returns the name of the currently logged in user.

  • Syntax
  • Examples
  • Related commands
  • Linux commands help

env — Report the value of environment variables.login — Begin a session on a system.