Heinrich Schuchardt | ec255f4 | 2022-06-19 13:59:22 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | printenv command |
| 4 | ================ |
| 5 | |
| 6 | Synopsis |
| 7 | -------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | printenv [-a] [name ...] |
| 12 | printenv -e [-guid guid][-n] [name] |
| 13 | |
| 14 | Description |
| 15 | ----------- |
| 16 | |
| 17 | The printenv command is used to print environment or UEFI variables. |
| 18 | |
| 19 | \-a |
| 20 | Print environment variables starting with a period ('.'). |
| 21 | |
| 22 | \-e |
| 23 | Print UEFI variables. Without -e environment variables are printed. |
| 24 | |
| 25 | \-guid *guid* |
| 26 | Specify vendor GUID *guid*. If none is specified, all UEFI variables with |
| 27 | the specified name are printed irrespective of their vendor GUID. |
| 28 | |
| 29 | \-n |
| 30 | don't show hexadecimal dump of value |
| 31 | |
| 32 | name |
| 33 | Variable name. If no name is provided, all variables are printed. |
| 34 | Multiple environment variable names may be specified. |
| 35 | |
| 36 | Examples |
| 37 | -------- |
| 38 | |
| 39 | The following examples demonstrates the effect of the *-a* flag when displaying |
| 40 | environment variables: |
| 41 | |
| 42 | :: |
| 43 | |
| 44 | => setenv .foo bar |
| 45 | => printenv |
| 46 | arch=sandbox |
| 47 | baudrate=115200 |
| 48 | board=sandbox |
| 49 | ... |
| 50 | stdout=serial,vidconsole |
| 51 | |
| 52 | Environment size: 644/8188 bytes |
| 53 | => printenv -a |
| 54 | .foo=bar |
| 55 | arch=sandbox |
| 56 | baudrate=115200 |
| 57 | board=sandbox |
| 58 | ... |
| 59 | stdout=serial,vidconsole |
| 60 | |
| 61 | Environment size: 653/8188 bytes |
| 62 | => |
| 63 | |
| 64 | The next example shows the effect of the *-n* flag when displaying an UEFI |
| 65 | variable and how to specify a vendor GUID: |
| 66 | |
| 67 | :: |
| 68 | |
| 69 | => printenv -e -guid 8be4df61-93ca-11d2-aa0d-00e098032b8c PlatformLangCodes |
| 70 | PlatformLangCodes: |
| 71 | 8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID) |
| 72 | BS|RT|RO, DataSize = 0x6 |
| 73 | 00000000: 65 6e 2d 55 53 00 en-US. |
| 74 | => printenv -e -n PlatformLangCodes |
| 75 | PlatformLangCodes: |
| 76 | 8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID) |
| 77 | BS|RT|RO, DataSize = 0x6 |
| 78 | => |
| 79 | |
| 80 | Configuration |
Heinrich Schuchardt | 16f77e1 | 2022-12-18 04:00:52 +0000 | [diff] [blame] | 81 | ------------- |
Heinrich Schuchardt | ec255f4 | 2022-06-19 13:59:22 +0200 | [diff] [blame] | 82 | |
| 83 | UEFI variables are only supported if CONFIG_CMD_NVEDIT_EFI=y. The value of UEFI |
| 84 | variables can only be displayed if CONFIG_HEXDUMP=y. |
| 85 | |
| 86 | Return value |
| 87 | ------------ |
| 88 | |
| 89 | The return value $? is 1 (false) if a specified variable is not found. |
| 90 | Otherwise $? is set to 0 (true). |