logname(1)

logname1

Display user's login name

Usage

logname

Overview

The logname utility writes the user's login name to standard output followed by a newline (‘\n’).

The logname utility explicitly ignores the LOGNAME and USER environment variables because the environment cannot be trusted.

Exit status

The logname utility exits 0 on success, and >0 if an error occurs.

Releases

61 releases since OpenBSD 2.1; the text changed 9 times.

  1. 2.1
  2. 2.2–2.3
  3. 2.4–2.5
  4. 2.6
  5. 2.7–3.3
  6. 3.4–4.1
  7. 4.2–4.4
  8. 4.5–4.8
  9. 4.9–7.1
  10. 7.2–8.0

Standards

The logname utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification.

History

The logname command first appeared in PWB/UNIX 1.0 and was reimplemented for 4.3BSD-Net/2.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's mdoc source.