procenv(1)

procenv1

Display process environment details

Usage

procenv [OPTION]

Overview

Display details of the process environment in a parseable format.

Options

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

-a, --meta

Display meta details.

-A, --arguments

Display program arguments.

-b, --libs

Display details of linked libraries. See dl_iterate_phdr(3).

-B, --libc

Display standard library details. See feature_test_macros(7) (Linux).

-c, --cgroups

Display cgroup details (Linux only). See proc(5).

-C, --cpu

Display CPU and scheduler details. See kvm_getprocs(3) (BSD), pthread_getaffinity_np(3), sched_getcpu(3) (Linux).

--crumb-separator=str (*)

Specify string str as alternate delimiter for crumb format output (default=':').

-d, --compiler

Display compiler details. See cpp(1), cc(1) and feature_test_macros(7) (Linux).

-e, --environment

Display environment variables. See environ(7).

-E, --semaphores

Display semaphore details (not queryable on BSD). See semctl(2).

--exec (*)

Treat non-option arguments as program to execute after running procenv. See exec(3).

-f, --fds

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).

-F, --namespaces

Display namespace details (Linux only). See proc(5).

--file=FILE (*)

Send output to file FILE (implies --output=file).

--file-append (*)

If --file is specifed, append to it rather than overwriting it.

--format=FORMAT (*)

Specify output format. FORMAT may be one of:

•

crumb ("breadcrumbs").

•

json (JavaScript Object Notation).

•

text (plain ASCII text) [default].

•

xml (Extensible Markup Language).

-g, --sizeof

Display sizes of data types.

-h, --help

This help text.

-i, --misc

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).

--indent (*)

Number of indent characters to use for each indent (default=2).

--indent-char=c (*)

Use character c for indenting (default=' ' (space)).

-j, --uname

Display uname details. See uname(2).

-k, --clocks

Display clock details. See clock_getres(2).

-l, --limits

Display limits. See getrlimit(2).

-L, --locale

Display locale details. See setlocale(3) and locale(7).

-m, --mounts

Display mount details. See getmntent(3) and statfs(2) (Linux), and getmntinfo(3) (BSD).

-M, --message-queues

Display message queue details (not queryable on BSD). See msgctl(2).

-n, --confstr

Display confstr details. See confstr(5).

-N, --network

Display network details. See getifaddrs(3), getnameinfo(3), ip(7), netdevice(7), and ioctl(2) (Linux).

-o, --oom

Display out-of-memory manager details (Linux only). See proc(5).

--output=TYPE (*)

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).

-P, --platform

Display platform details.

-q, --time

Display time details. See clock_gettime(2), localtime(3) and asctime(3).

-r, --ranges

Display range of data types. See limits.h(P).

-s, --signals

Display signal details. See sigaction(2).

-S, --shared-memory

Display shared memory details (not queryable on BSD). See shmctl(2).

--separator=str (*)

Specify string str as alternate delimiter for text format output (default=': ').

-t, --tty

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).

-u, --stat

Display stat details. See stat(2).

-U, --rusage

Display rusage details. See getrusage(2).

-v, --version

Display version details.

-w, --capabilities

Display Linux capability details. For FreeBSD file descriptor capabilities, see --file-descriptors. See prctl(2) (Linux), libcap(3) (Linux).

-x, --pathconf

Display pathconf details. See pathconf(3).

-y, --sysconf

Display sysconf details. See sysconf(3) and posixoptions(7) (Linux).

-Y, --memory

Display memory details. See getpagesize(2), numa(3) (Linux) and numa(7) (Linux).

-z, --timezone

Display timezone details. See tzset(3).

Environment

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

PROCENV_CRUMB_SEPARATOR

Alternative to --crumb-separator.

PROCENV_EXEC

Alternative to --exec.

PROCENV_FILE

Alternative to --file.

PROCENV_FILE_APPEND

Alternative to --file-append.

PROCENV_FORMAT

Alternative to --format.

PROCENV_INDENT

Alternative to --indent.

PROCENV_INDENT_CHAR

Alternative to --indent-char.

PROCENV_SEPARATOR

Alternative to --separator.

PROCENV_OUTPUT

Alternative to --output.

Notes

•

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.

Examples

 # 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='='

Limitations

•

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.

Releases

6 releases since Debian 8 (Jessie); the text changed 2 times.

  1. 8
  2. 9
  3. 10–13

--file-append since Debian 10 (Buster); --libc since Debian 9 (Stretch); --namespaces since Debian 9 (Stretch); -B since Debian 9 (Stretch); -F since Debian 9 (Stretch).

--crumb-separator until Debian 8 (Jessie); --file until Debian 8 (Jessie); --format until Debian 8 (Jessie); --indent-char until Debian 8 (Jessie); --output until Debian 8 (Jessie); --separator until Debian 8 (Jessie).

Authors

Written by James Hunt <[email protected]> and Kees Cook <[email protected]>.

License

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.

From procenv 0.51-0.2 in Debian 13 (Trixie). Parsed by carta from the page's man source.