1PROCENV(1) General Commands Manual PROCENV(1)
2
3
4
6 procenv - display process environment details
7
9 procenv [OPTION]
10
12 Display details of the process environment in a parseable format.
13
15 Options shown with a bracketed asterisk '(*)' are non-display options
16 and must precede any other (display) options.
17
18
19 -a, --meta
20 Display meta details.
21
22 -A, --arguments
23 Display program arguments.
24
25 -b, --libs
26 Display details of linked libraries. See dl_iterate_phdr(3).
27
28 -B, --libc
29 Display standard library details. See feature_test_macros(7)
30 (Linux).
31
32 -c, --cgroups
33 Display cgroup details (Linux only). See proc(5).
34
35 -C, --cpu
36 Display CPU and scheduler details. See kvm_getprocs(3) (BSD),
37 pthread_getaffinity_np(3), sched_getcpu(3) (Linux).
38
39 --crumb-separator=str (*)
40 Specify string str as alternate delimiter for crumb format out‐
41 put (default=':').
42
43 -d, --compiler
44 Display compiler details. See cpp(1), cc(1) and fea‐
45 ture_test_macros(7) (Linux).
46
47 -e, --environment
48 Display environment variables. See environ(7).
49
50 -E, --semaphores
51 Display semaphore details (not queryable on BSD). See sem‐
52 ctl(2).
53
54 --exec (*)
55 Treat non-option arguments as program to execute after running
56 procenv. See exec(3).
57
58 -f, --fds
59 Display file descriptor details. Under FreeBSD, file descriptor
60 capabilities will also be displayed assuming the kernel has Cap‐
61 sicum support. See cap_getmode(2) (BSD), cap_rights_get(2)
62 (BSD), cap_rights_is_set(3) (BSD), fcntl(2), isatty(5).
63
64 -F, --namespaces
65 Display namespace details (Linux only). See proc(5).
66
67 --file=FILE (*)
68 Send output to file FILE (implies --output=file).
69
70 --file-append (*)
71 If --file is specified, append to it rather than overwriting it.
72
73 --format=FORMAT (*)
74 Specify output format. FORMAT may be one of:
75
76 • crumb ("breadcrumbs").
77
78 • json (JavaScript Object Notation).
79
80 • text (plain ASCII text) [default].
81
82 • xml (Extensible Markup Language).
83
84 -g, --sizeof
85 Display sizes of data types.
86
87 -h, --help
88 This help text.
89
90 -i, --misc
91 Display miscellaneous details. See umask(P), getcwd(3), person‐
92 ality(2) (Linux), proc(5), prctl(2), aa_getcon(2) (Linux), get‐
93 pidcon(3) (Linux), sysconf(3), kvm_getprocs(3) (BSD), getprior‐
94 ity(2).
95
96 --indent (*)
97 Number of indent characters to use for each indent (default=2).
98
99 --indent-char=c (*)
100 Use character c for indenting (default=' ' (space)).
101
102 -j, --uname
103 Display uname details. See uname(2).
104
105 -k, --clocks
106 Display clock details. See clock_getres(2).
107
108 -l, --limits
109 Display limits. See getrlimit(2).
110
111 -L, --locale
112 Display locale details. See setlocale(3) and locale(7).
113
114 -m, --mounts
115 Display mount details. See getmntent(3) and statfs(2) (Linux),
116 and getmntinfo(3) (BSD).
117
118 -M, --message-queues
119 Display message queue details (not queryable on BSD). See ms‐
120 gctl(2).
121
122 -n, --confstr
123 Display confstr details. See confstr(5).
124
125 -N, --network
126 Display network details. See getifaddrs(3), getnameinfo(3),
127 ip(7), netdevice(7), and ioctl(2) (Linux).
128
129 -o, --oom
130 Display out-of-memory manager details (Linux only). See
131 proc(5).
132
133 --output=TYPE (*)
134 Send output to alternative location. TYPE can be one of:
135
136 • file (send output to a file).
137
138 • stderr (write to standard error).
139
140 • stdout (write to standard output (default)).
141
142 • syslog (write to the system log file).
143
144 • terminal (write to terminal).
145
146 -p, --process
147 Display process details. See getpid(2), getppid(2), getre‐
148 suid(2), getresgid(2), getuid(2), geteuid(2), getgid(2), gete‐
149 gid(2), getsid(2), getlogin(3), getpgrp(2), ctermid(3), tcgetp‐
150 grp(3), tcgetsid(3), getpwuid(3) and getgroups(2).
151
152 -P, --platform
153 Display platform details.
154
155 -q, --time
156 Display time details. See clock_gettime(2), localtime(3) and
157 asctime(3).
158
159 -r, --ranges
160 Display range of data types. See limits.h(P).
161
162 -s, --signals
163 Display signal details. See sigaction(2).
164
165 -S, --shared-memory
166 Display shared memory details (not queryable on BSD). See shm‐
167 ctl(2).
168
169 --separator=str (*)
170 Specify string str as alternate delimiter for text format output
171 (default=': ').
172
173 -t, --tty
174 Display terminal details. On Linux, will also show if any at‐
175 tributes are locked when running as root. See tcgetattr(3) and
176 tty_ioctl(4) (Linux).
177
178 -T, --threads
179 Display thread details. See pthread_attr_getstacksize(3),
180 pthread_attr_getstacksize(3) and pthread_attr_getguardsize(3).
181
182 -u, --stat
183 Display stat details. See stat(2).
184
185 -U, --rusage
186 Display rusage details. See getrusage(2).
187
188 -v, --version
189 Display version details.
190
191 -w, --capabilities
192 Display Linux capability details. For FreeBSD file descriptor
193 capabilities, see --fds. See prctl(2) (Linux), libcap(3)
194 (Linux).
195
196 -x, --pathconf
197 Display pathconf details. See pathconf(3).
198
199 -y, --sysconf
200 Display sysconf details. See sysconf(3) and posixoptions(7)
201 (Linux).
202
203 -Y, --memory
204 Display memory details. See getpagesize(2), numa(3) (Linux) and
205 numa(7) (Linux), sysinfo(3).
206
207 -z, --timezone
208 Display timezone details. See tzset(3).
209
211 The following environment variables may be used as aliases to their
212 command-line counterparts:
213
214 PROCENV_CRUMB_SEPARATOR
215 Alternative to --crumb-separator.
216
217 PROCENV_EXEC
218 Alternative to --exec.
219
220 PROCENV_FILE
221 Alternative to --file.
222
223 PROCENV_FILE_APPEND
224 Alternative to --file-append.
225
226 PROCENV_FORMAT
227 Alternative to --format.
228
229 PROCENV_INDENT
230 Alternative to --indent.
231
232 PROCENV_INDENT_CHAR
233 Alternative to --indent-char.
234
235 PROCENV_SEPARATOR
236 Alternative to --separator.
237
238 PROCENV_OUTPUT
239 Alternative to --output.
240
242 • Options are considered in order, so --output should precede any
243 other option.
244
245 • If no display option is specified, all details are displayed.
246
247 • Only one display option may be specified.
248
249 • Command-line options take priority over environment variables.
250
251 • All values for --indent-char are literal except '\t' which can be
252 used to specify a tab character. The same is true for --separa‐
253 tor-char and --crumb-separator but only if it is the first charac‐
254 ter specified.
255
256 • Specifying a visible indent-char is only (vaguely) meaningful for
257 text output.
258
259 • If --exec is specified, at least one non-option argument must also
260 be specified.
261
262 • Any long option name may be shortened as long as it remains unique.
263
264 • The crumb output format is designed for easy parsing: it displays
265 the data in a flattened format with each value on a separate line
266 preceded by all appropriate headings which are separated by the
267 current separator.
268
269 • The --message-queues, --semaphores and --shared-memory options are
270 not available on BSD since although the values are queryable, there
271 is no documented method to do so.
272
273
275 # Show limits
276 procenv -l
277
278 # Send compiler information to syslog (note the order of the options).
279 procenv --output=syslog --compiler
280
281 # Write compiler details direct to the terminal
282 procenv --output=terminal --compiler
283
284 # Run a command ('mycmd --arg1 --foo=bar') without creating a new
285 # process, but have procenv run first and log its output to a
286 # regular file.
287 exec procenv --file=/tmp/procenv.log --exec -- mycmd --arg1 --foo=bar
288
289 # The following kernel command-line snippet will cause procenv to
290 # run as PID 1 and write output to the first serial tty device. It will then
291 # execute the init daemon (specifying some arguments to show how this is possible).
292 # Note that since procenv re-executes, the init daemon will (also) be run as PID 1.
293 init=/usr/bin/procenv PROCENV_FILE=/dev/ttyS0 PROCENV_EXEC="/sbin/init --foo-bar --baz"
294
295 # Display all data in JSON format using an indent of 4 spaces
296 procenv --format=json --indent=4
297
298 # Display all data in XML format using tabs for indents
299 procenv --format=xml --indent-char="\t"
300
301 # Display signal details in XML format
302 procenv --format=xml --signals
303
304 # Display resource limits in easily-parseable format
305 procenv --format=crumb --limits
306
307 # Produce output suitable for importing into a spreadsheet
308 procenv --format=crumb --crumb-separator=',' --separator=',' --limits
309
310 # Produce stylised output
311 procenv --format=crumb --crumb-separator=' → ' --separator='='
312
313
315 • Spaces within the value of PROCENV_EXEC are treated as delimiters
316 meaning that any spaces within a string argument for example will
317 result in incorrect behaviour.
318
319 • The separator character must be chosen carefully since no check is
320 performed on the data to see if it itself contains instances of the
321 separator character.
322
324 Written by James Hunt <jamesodhunt@gmail.com> and Kees Cook
325 <kees@ubuntu.com>.
326
328 Copyright © 2012-2021 James Hunt <jamesodhunt@gmail.com> and Kees Cook
329 <kees@ubuntu.com>.
330 This is free software; see the source for copying conditions. There is
331 NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
332 PURPOSE.
333
335 GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
336 This is free software: you are free to change and redistribute it.
337 There is NO WARRANTY, to the extent permitted by law.
338
340 capabilities(7) (Linux), capsicum(4) (BSD), cc(1), clock_gettime(2)
341 (Linux), credentials(7), date(1), env(1), exec(P), getconf(1),
342 groups(1), ifconfig(8), ip(9), ipcs(1), kill(1), ldd(1), locale(1),
343 ls(1), mount(1), proc(5), ps(1), rights(4)(BSD), sh(1), stat(1),
344 stty(1), umask(P), uname(1)
345
346
347
348User Commands 2016-03-10 PROCENV(1)