summaryrefslogtreecommitdiff
path: root/man/procenv.1
blob: d7f92877a548f1927d7a61aacdec585df90a685e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
.TH PROCENV "1" "2016-03-10" "User Commands"
.\"
.SH NAME
procenv \- display process environment details
.\" Macros
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\"
.SH SYNOPSIS
.B procenv
[\fIOPTION\fR]
.\"
.SH DESCRIPTION
Display details of the process environment in a parseable format.
.\"
.SH OPTIONS
.\"
Options shown with a bracketed asterisk \(aq(*)\(aq are non-display
options and must preceed any other (display) options.

.TP
\fB\-a\fR, \fB\-\-meta\fR
Display meta details.
.\"
.TP
\fB\-A\fR, \fB\-\-arguments\fR
Display program arguments.
.\"
.TP
\fB\-b\fR, \fB\-\-libs\fR
Display details of linked libraries.
See
.BR dl_iterate_phdr (3) "" .
.\"
.TP
\fB\-B\fR, \fB\-\-libc\fR
Display standard library details.
See
.BR feature_test_macros (7) "" " (Linux)."
.\"
.TP
\fB\-c\fR, \fB\-\-cgroups\fR
Display cgroup details (Linux only).
See
.BR proc (5) "" .
.\"
.TP
\fB\-C\fR, \fB\-\-cpu\fR
Display CPU and scheduler details.
See
.BR kvm_getprocs (3) "" " (BSD), "
.BR pthread_getaffinity_np (3) ", "
.BR sched_getcpu (3) "" " (Linux)" "" "."
.\"
.TP
\fB\-\-crumb\-separator=\fR\fIstr\fR (*)
Specify string
.I str
as alternate delimiter for crumb format output (default=\(aq:\(aq).
.\"
.TP
\fB\-d\fR, \fB\-\-compiler\fR
Display compiler details.
See
.BR cpp (1) "" ", " cc (1) "" " and " feature_test_macros (7) "" " (Linux)."
.\"
.TP
\fB\-e\fR, \fB\-\-environment\fR
Display environment variables.
See
.BR environ (7) "" .
.\"
.TP
\fB\-E\fR, \fB\-\-semaphores\fR
Display semaphore details (not queryable on BSD).
See
.BR semctl (2) "" .
.\"
.TP
\fB\-\-exec\fR (*)
Treat non-option arguments as program to execute after running
\fBprocenv\fR.
See
.BR exec (3) "" .
.\"
.TP
\fB\-f\fR, \fB\-\-fds\fR
Display file descriptor details. Under FreeBSD, file descriptor
capabilities will also be displayed assuming the kernel has Capsicum
support.
See
.BR cap_getmode (2) "" " (BSD)" "" ", "
.BR cap_rights_get (2) "" " (BSD)" "" ", "
.BR cap_rights_is_set (3) "" " (BSD)" "" ", "
.BR fcntl (2) "" ", "
.BR isatty (5) "" "."
.\"
.TP
\fB\-F\fR, \fB\-\-namespaces\fR
Display namespace details (Linux only).
See
.BR proc (5) "" .
.\"
.TP
\fB\-\-file=\fR\fIFILE\fR (*)
Send output to file \fIFILE\fR (implies \fB\-\-output=file\fR).
.\"
.TP
\fB\-\-file\-append\fR (*)
If \fB\-\-file\fR is specifed, append to it rather than
overwriting it.
.PP
.\"
.TP
\fB\-\-format=\fR\fIFORMAT\fR (*)
Specify output format.
.I FORMAT
may be one of:
.RS
.IP \(bu 4
\fIcrumb\fR ("breadcrumbs").
.IP \(bu 4
\fIjson\fR (JavaScript Object Notation).
.IP \(bu 4
\fItext\fR (plain ASCII text) [default].
.IP \(bu 4
\fIxml\fR (Extensible Markup Language).
.RE
.PP
.\"
.TP
\fB\-g\fR, \fB\-\-sizeof\fR
Display sizes of data types.
.\"
.TP
\fB\-h\fR, \fB\-\-help\fR
This help text.
.\"
.TP
\fB\-i\fR, \fB\-\-misc\fR
Display miscellaneous details.
See
.BR umask (P) "" ", "
.BR getcwd (3) "" ", "
.BR personality (2) "" " (Linux), "
.BR proc (5) "" ", "
.BR prctl (2) "" ", "
.BR aa_getcon (2) "" " (Linux), "
.BR getpidcon (3) "" " (Linux), "
.BR sysconf (3) "" ", "
.BR kvm_getprocs (3) "" " (BSD), "
.BR getpriority (2) "" .
.\"
.TP
\fB\-\-indent\fR (*)
Number of indent characters to use for each indent
(default=2).
.\"
.TP
\fB\-\-indent\-char=\fR\fIc\fR (*)
Use character
.I c
for indenting
(default=\(aq \(aq (space)).
.\"
.TP
\fB\-j\fR, \fB\-\-uname\fR
Display uname details.
See
.BR uname (2) "" .
.\"
.TP
\fB\-k\fR, \fB\-\-clocks\fR
Display clock details.
See
.BR clock_getres (2) "" .
.\"
.TP
\fB\-l\fR, \fB\-\-limits\fR
Display limits.
See
.BR getrlimit (2) "" .
.\"
.TP
\fB\-L\fR, \fB\-\-locale\fR
Display locale details.
See
.BR setlocale (3) "" " and " locale (7) "" .
.\"
.TP
\fB\-m\fR, \fB\-\-mounts\fR
Display mount details.
See
.BR getmntent (3) "" " and " statfs (2) "" " (Linux), and " getmntinfo (3) "" " (BSD)."
.PP
.\"
.TP
\fB\-M\fR, \fB\-\-message\-queues\fR
Display message queue details (not queryable on BSD).
See
.BR msgctl (2) "" .
.\"
.TP
\fB\-n\fR, \fB\-\-confstr\fR
Display confstr details.
See
.BR confstr (5) "" .
.PP
.\"
.TP
\fB\-N\fR, \fB\-\-network\fR
Display network details.
See
.BR getifaddrs (3) "" ", " getnameinfo (3) "" ", " ip (7) "" ", " netdevice (7) "" ", and " ioctl (2) " (Linux)" .
.PP
.\"
.TP
\fB\-o\fR, \fB\-\-oom\fR
Display out-of-memory manager details (Linux only).
See
.BR proc (5) "" .
.PP
.\"
.TP
\fB\-\-output=\fR\fITYPE\fR (*)
Send output to alternative location. \fITYPE\fR can be one of:
.RS
.IP \(bu 4
\fIfile\fR (send output to a file).
.IP \(bu 4
\fIstderr\fR (write to standard error).
.IP \(bu 4
\fIstdout\fR (write to standard output (default)).
.IP \(bu 4
\fIsyslog\fR (write to the system log file).
.IP \(bu 4
\fIterminal\fR (write to terminal).
.RE
.PP
.\"
.TP
\fB\-p\fR, \fB\-\-process\fR
Display process details.
See
.BR getpid (2) "" ", "
.BR getppid (2) "" ", "
.BR getresuid (2) "" ", "
.BR getresgid (2) "" ", "
.BR getuid (2) "" ", "
.BR geteuid (2) "" ", "
.BR getgid (2) "" ", "
.BR getegid (2) "" ", "
.BR getsid (2) "" ", "
.BR getlogin (3) "" ", "
.BR getpgrp (2) "" ", "
.BR ctermid (3) "" ", "
.BR tcgetpgrp (3) "" ", "
.BR tcgetsid (3) "" ", "
.BR getpwuid (3) "" " and "
.BR getgroups (2) "" .
.PP
.\"
.TP
\fB\-P\fR, \fB\-\-platform\fR
Display platform details.
.\"
.TP
\fB\-q\fR, \fB\-\-time\fR
Display time details.
See
.BR clock_gettime (2) "" ", "
.BR localtime (3) "" " and "
.BR asctime (3) "" .
.PP
.\"
.TP
\fB\-r\fR, \fB\-\-ranges\fR
Display range of data types.
See
.BR limits.h (P) "" .
.PP
.\"
.TP
\fB\-s\fR, \fB\-\-signals\fR
Display signal details.
See
.BR sigaction (2) "" .
.PP
.\"
.TP
\fB\-S\fR, \fB\-\-shared\-memory\fR
Display shared memory details (not queryable on BSD).
See
.BR shmctl (2) "" .
.PP
.\"
.TP
\fB\-\-separator=\fR\fIstr\fR (*)
Specify string
.I str
as alternate delimiter for text format output (default=\(aq: \(aq).
.\"
.TP
\fB\-t\fR, \fB\-\-tty\fR
Display terminal details. On Linux, will also show if any attributes are
locked when running as
.IR root "."
See
.BR tcgetattr (3) "" " and " "" " " tty_ioctl (4) "" " (Linux)."
.PP
.\"
.TP
\fB\-T\fR, \fB\-\-threads\fR
Display thread details.
See
.BR pthread_attr_getstacksize (3) "" ", "
.BR pthread_attr_getstacksize (3) "" " and "
.BR pthread_attr_getguardsize (3) "" .
.PP
.\"
.TP
\fB\-u\fR, \fB\-\-stat\fR
Display stat details.
See
.BR stat (2) "" .
.PP
.\"
.TP
\fB\-U\fR, \fB\-\-rusage\fR
Display rusage details.
See
.BR getrusage (2) "" .
.PP
.\"
.TP
\fB\-v\fR, \fB\-\-version\fR
Display version details.
.PP
.\"
.TP
\fB\-w\fR, \fB\-\-capabilities\fR
Display Linux capability details. For FreeBSD file descriptor
capabilities, see \fB\-\-file\-descriptors\fR.
See
.BR prctl (2) "" " (Linux)" "" ","
.BR libcap (3) "" " (Linux)" "" "."
.PP
.\"
.TP
\fB\-x\fR, \fB\-\-pathconf\fR
Display pathconf details.
See
.BR pathconf (3) "" .
.PP
.\"
.TP
\fB\-y\fR, \fB\-\-sysconf\fR
Display sysconf details.
See
.BR sysconf (3) "" " and " posixoptions (7) "" " (Linux)."
.PP
.\"
.TP
\fB\-Y\fR, \fB\-\-memory\fR
Display memory details.
See
.BR getpagesize (2) "" ", "
.BR numa (3) "" " (Linux) and " numa (7) "" " (Linux)."
.PP
.\"
.TP
\fB\-z\fR, \fB\-\-timezone\fR
Display timezone details.
See
.BR tzset (3) "" .
.PP
.\"
.SH ENVIRONMENT VARIABLES
.\"
The following environment variables may be used as aliases to their
command-line counterparts:
.\"
.TP
\fBPROCENV_CRUMB_SEPARATOR\fR
Alternative to \fB\-\-crumb\-separator\fR.
.PP
.\"
.TP
\fBPROCENV_EXEC\fR
Alternative to \fB\-\-exec\fR.
.PP
.\"
.TP
\fBPROCENV_FILE\fR
Alternative to \fB\-\-file\fR.
.\"
.TP
\fBPROCENV_FILE_APPEND\fR
Alternative to \fB\-\-file\-append\fR.
.PP
.\"
.TP
\fBPROCENV_FORMAT\fR
Alternative to \fB\-\-format\fR.
.PP
.\"
.TP
\fBPROCENV_INDENT\fR
Alternative to \fB\-\-indent\fR.
.PP
.\"
.TP
\fBPROCENV_INDENT_CHAR\fR
Alternative to \fB\-\-indent\-char\fR.
.PP
.\"
.TP
\fBPROCENV_SEPARATOR\fR
Alternative to \fB\-\-separator\fR.
.PP
.\"
.TP
\fBPROCENV_OUTPUT\fR
Alternative to \fB\-\-output\fR.
.PP
.\"
.SH NOTES
.IP \(bu 4
Options are considered in order, so \fB\-\-output\fR should
precede any other option.
.IP \(bu 4
If no display option is specified, all details are displayed.
.IP \(bu
Only one display option may be specified.
.IP \(bu
Command-line options take priority over environment variables.
.IP \(bu
All values for \fB\-\-indent\-char\fR are literal except \(aq\\t\(aq which can be
used to specify a tab character. The same is true for \fB\-\-separator\-char\fR and
\fB\-\-crumb\-separator\fR but only if it is the first character
specified.
.IP \(bu
Specifying a visible indent\-char is only (vaguely) meaningful for text output.
.IP \(bu
If \fB\-\-exec\fR is specified, atleast one non-option argument must also be
specified.
.IP \(bu
Any long option name may be shortened as long as it remains unique.
.IP \(bu
The
.I 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.
.IP \(bu
The \fB\-\-message\-queues\fR, \fB\-\-semaphores\fR and 
\fB\-\-shared\-memory\fR options are not available on BSD since although
the values are queryable, there is no documented method to do so.
.sp 1
.\"
.SH EXAMPLES
.\"
.Vb
\& # 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=\(aq,\(aq \-\-separator=\(aq,\(aq \-\-limits
\&
\& # Produce stylised output
\& procenv \-\-format=crumb \-\-crumb\-separator=\(aq \[u2192] \(aq \-\-separator=\(aq=\(aq
\&
.Ve
.Ve
.\"
.SH LIMITATIONS
.IP \(bu 4
Spaces within the value of \fBPROCENV_EXEC\fR are treated as delimiters
meaning that any spaces within a string argument for example will result in
incorrect behaviour.
.IP \(bu 4
The separator character must be chosen carefully since no check is
performed on the data to see if
.I it itself
contains instances of the separator character.
.\"
.SH AUTHORS
Written by
James Hunt
.RB < jamesodhunt@ubuntu.com >
and
Kees Cook
.RB < kees@ubuntu.com > "" "."
.\"
.SH COPYRIGHT
Copyright \(co 2012-2016 James Hunt
.RB < jamesodhunt@ubuntu.com >
and
Kees Cook
.RB < kees@ubuntu.com > "" "."
.br
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
.\"
.SH LICENSE
GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.\"
.SH SEE ALSO
.BR capabilities (7) "" " (Linux), "
.BR capsicum (4) "" " (BSD)" "" ", "
.BR cc (1) "" ,
.BR credentials (7) "" ,
.BR date (1) "" ,
.BR env (1) "" ,
.BR exec (P) "" ,
.BR getconf (1) "" ,
.BR groups (1) "" ,
.BR ifconfig (8) "" ,
.BR ip (9) "" ,
.BR ipcs (1) "" ,
.BR kill (1) "" ,
.BR ldd (1) "" ,
.BR locale (1) "" ,
.BR ls (1) "" ,
.BR mount (1) "" ,
.BR proc (5) "" ,
.BR ps (1) "" ,
.BR rights (4) "" (BSD),
.BR sh (1) "" ,
.BR stat (1) "" ,
.BR stty (1) "" ,
.BR umask (P) "" ,
.BR uname (1)