For a consistent look and feel for both local and remote CLI administration, the new “esxcli” command provides the ability to format the command output. Using the “--formatter” option, administrators can choose to have the command output formatted as XML, a key-value pair or a list of comma-separated values. The “esxcli” formatter enhances your ability to parse command output, helping to simplify scripting and improve report generation. In addition, you can specify which fields to include in the output. In the following example, we need to generate a report showing all the storage volume names with their free space. We start by running the storage filesystem list command, as follows: esxcli --formatter=csv storage filesystem list
The output gives us the information we need, but it is very verbose, requiring the user to use the scroll bar to see the data for all the volumes. Because we need only a summary showing the volume name and free space, we can refine our command using the --formatter and --format-param options, as follows: esxcli --formatter=csv --format-param=fields="Free,VolumeName" storage filesystem list
More information about the ESXCLI command can be found at this link.