program_invocation_short_name(3)

program_invocation_short_name3

Obtain name used to invoke calling program

Part of program_invocation_name(3).

Usage

#define _GNU_SOURCE         /* See feature_test_macros(7) */
#include <errno.h>

extern char *program_invocation_name; extern char *program_invocation_short_name;

Library

Standard C library (libc, -lc)

Overview

program_invocation_name contains the name that was used to invoke the calling program. This is the same as the value of argv[0] in main(), with the difference that the scope of program_invocation_name is global.

program_invocation_short_name contains the basename component of name that was used to invoke the calling program. That is, it is the same value as program_invocation_name, with all text up to and including the final slash (/), if any, removed.

These variables are automatically initialized by the glibc run-time startup code.

Versions

The Linux-specific /proc/pid/cmdline file provides access to similar information.

Releases

11 releases since Debian 4.0 (Etch); the text changed 10 times.

  1. 4.0
  2. 5.0
  3. 6.0
  4. 7
  5. 8
  6. 9
  7. 10
  8. 11
  9. 12
  10. 13
  11. Arch

Standards

GNU.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.