DOKK / manpages / debian 12 / procenv / procenv.1.en
PROCENV(1) General Commands Manual PROCENV(1)

procenv - display process environment details

procenv [OPTION]

Display details of the process environment in a parseable format.

Options shown with a bracketed asterisk '(*)' are non-display options and must preceed any other (display) options.

Display meta details.
Display program arguments.
Display details of linked libraries. See dl_iterate_phdr(3).
Display standard library details. See feature_test_macros(7) (Linux).
Display cgroup details (Linux only). See proc(5).
Display CPU and scheduler details. See kvm_getprocs(3) (BSD), pthread_getaffinity_np(3), sched_getcpu(3) (Linux).
Specify string str as alternate delimiter for crumb format output (default=':').
Display compiler details. See cpp(1), cc(1) and feature_test_macros(7) (Linux).
Display environment variables. See environ(7).
Display semaphore details (not queryable on BSD). See semctl(2).
Treat non-option arguments as program to execute after running procenv. See exec(3).
Display file descriptor details. Under FreeBSD, file descriptor capabilities will also be displayed assuming the kernel has Capsicum support. See cap_getmode(2) (BSD), cap_rights_get(2) (BSD), cap_rights_is_set(3) (BSD), fcntl(2), isatty(5).
Display namespace details (Linux only). See proc(5).
Send output to file FILE (implies --output=file).
If --file is specifed, append to it rather than overwriting it.
Specify output format. FORMAT may be one of:
  • crumb ("breadcrumbs").
  • json (JavaScript Object Notation).
  • text (plain ASCII text) [default].
  • xml (Extensible Markup Language).
Display sizes of data types.
This help text.
Display miscellaneous details. See umask(P), getcwd(3), personality(2) (Linux), proc(5), prctl(2), aa_getcon(2) (Linux), getpidcon(3) (Linux), sysconf(3), kvm_getprocs(3) (BSD), getpriority(2).
Number of indent characters to use for each indent (default=2).
Use character c for indenting (default=' ' (space)).
Display uname details. See uname(2).
Display clock details. See clock_getres(2).
Display limits. See getrlimit(2).
Display locale details. See setlocale(3) and locale(7).
Display mount details. See getmntent(3) and statfs(2) (Linux), and getmntinfo(3) (BSD).
Display message queue details (not queryable on BSD). See msgctl(2).
Display confstr details. See confstr(5).
Display network details. See getifaddrs(3), getnameinfo(3), ip(7), netdevice(7), and ioctl(2) (Linux).
Display out-of-memory manager details (Linux only). See proc(5).
Send output to alternative location. TYPE can be one of:
  • file (send output to a file).
  • stderr (write to standard error).
  • stdout (write to standard output (default)).
  • syslog (write to the system log file).
  • terminal (write to terminal).
Display process details. See getpid(2), getppid(2), getresuid(2), getresgid(2), getuid(2), geteuid(2), getgid(2), getegid(2), getsid(2), getlogin(3), getpgrp(2), ctermid(3), tcgetpgrp(3), tcgetsid(3), getpwuid(3) and getgroups(2).
Display platform details.
Display time details. See clock_gettime(2), localtime(3) and asctime(3).
Display range of data types. See limits.h(P).
Display signal details. See sigaction(2).
Display shared memory details (not queryable on BSD). See shmctl(2).
Specify string str as alternate delimiter for text format output (default=': ').
Display terminal details. On Linux, will also show if any attributes are locked when running as root. See tcgetattr(3) and tty_ioctl(4) (Linux).
Display thread details. See pthread_attr_getstacksize(3), pthread_attr_getstacksize(3) and pthread_attr_getguardsize(3).
Display stat details. See stat(2).
Display rusage details. See getrusage(2).
Display version details.
Display Linux capability details. For FreeBSD file descriptor capabilities, see --file-descriptors. See prctl(2) (Linux), libcap(3) (Linux).
Display pathconf details. See pathconf(3).
Display sysconf details. See sysconf(3) and posixoptions(7) (Linux).
Display memory details. See getpagesize(2), numa(3) (Linux) and numa(7) (Linux).
Display timezone details. See tzset(3).

The following environment variables may be used as aliases to their command-line counterparts:

Alternative to --crumb-separator.
Alternative to --exec.
Alternative to --file.
Alternative to --file-append.
Alternative to --format.
Alternative to --indent.
Alternative to --indent-char.
Alternative to --separator.
Alternative to --output.

  • Options are considered in order, so --output should precede any other option.
  • If no display option is specified, all details are displayed.
  • Only one display option may be specified.
  • Command-line options take priority over environment variables.
  • All values for --indent-char are literal except '\t' which can be used to specify a tab character. The same is true for --separator-char and --crumb-separator but only if it is the first character specified.
  • Specifying a visible indent-char is only (vaguely) meaningful for text output.
  • If --exec is specified, atleast one non-option argument must also be specified.
  • Any long option name may be shortened as long as it remains unique.
  • The crumb output format is designed for easy parsing: it displays the data in a flattened format with each value on a separate line preceded by all appropriate headings which are separated by the current separator.
  • The --message-queues, --semaphores and --shared-memory options are not available on BSD since although the values are queryable, there is no documented method to do so.

 # Show limits
 procenv -l
 # Send compiler information to syslog (note the order of the options).
 procenv --output=syslog --compiler
 # Write compiler details direct to the terminal
 procenv --output=terminal --compiler
 # Run a command ('mycmd --arg1 --foo=bar') without creating a new
 # process, but have procenv run first and log its output to a
 # regular file.
 exec procenv --file=/tmp/procenv.log --exec -- mycmd --arg1 --foo=bar
 # The following kernel command-line snippet will cause procenv to
 # write output to first serial tty device and then execute init(8)
 # in debug mode to allow early boot environment to be examined.
 init=/usr/bin/procenv PROCENV_FILE=/dev/ttyS0 PROCENV_EXEC="/sbin/init --debug"
 # Display all data in JSON format using an indent of 4 spaces
 procenv --format=json --indent=4
 # Display all data in XML format using tabs for indents
 procenv --format=xml --indent-char="\t"
 # Display signal details in XML format
 procenv --format=xml --signals
 # Display resource limits in easily-parseable format
 procenv --format=crumb --limits
 # Produce output suitable for importing into a spreadsheet
 procenv --format=crumb --crumb-separator=',' --separator=',' --limits
 # Produce stylised output
 procenv --format=crumb --crumb-separator=' → ' --separator='='

  • Spaces within the value of PROCENV_EXEC are treated as delimiters meaning that any spaces within a string argument for example will result in incorrect behaviour.
  • The separator character must be chosen carefully since no check is performed on the data to see if it itself contains instances of the separator character.

Written by James Hunt <jamesodhunt@ubuntu.com> and Kees Cook <kees@ubuntu.com>.

Copyright © 2012-2016 James Hunt <jamesodhunt@ubuntu.com> and Kees Cook <kees@ubuntu.com>.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GNU GPL version 3 or later <http://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.

capabilities(7) (Linux), capsicum(4) (BSD), cc(1), credentials(7), date(1), env(1), exec(P), getconf(1), groups(1), ifconfig(8), ip(9), ipcs(1), kill(1), ldd(1), locale(1), ls(1), mount(1), proc(5), ps(1), rights(4)(BSD), sh(1), stat(1), stty(1), umask(P), uname(1)

2016-03-10 User Commands