Command to tree list directory structure in Mac OS X

Found this very useful command to recursively list a directory structure in a graphical format in Mac OS X:

find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'

It is the equivalent of the tree command in Linux and Windows.

An simple example of the output is below:

|____Test1 (1080P)
| |____Test1 (1080P).mkv
|____Test2 (1080P)
| |____Test2 (1080P).mkv
|____Test3 (1080P)
| |____Test3 (1080P).mkv
|____Test4 (1080P)
| |____Test4 (1080P).mkv

A very useful command on Mac OS X.

PowerCLI command to list all PortGroups on an ESX/ESXi host

A Lead Engineer asked me to send him a list of all PortGroups on a specific ESX host (running ESX 4.1). Due to the time and effort required to obtain this info manually, I had to use PowerCLI. I ran the command below:

Get-VirtualPortGroup -VMHost esx1 | select Name, VirtualSwitch, VLanId

It outputs results similar to the below:

Name                     VirtualSwitch      VLanId
----                     -------------      ------
DMZ-VLAN                 vSwitch0           1139
Inside-VLAN              vSwitch0           805
VMNet                    vSwitch1           0
VMNet-KS                 vSwitch1           124
VMNet-SC                 vSwitch1           0
VMNet-vmk                vSwitch1           0
Backup-Inside-VLAN       vSwitch2           648
Backup-DMZ-VLAN          vSwitch2           647

To get the results in a spreadsheet export the results to a csv file per the below:

Get-VirtualPortGroup -VMHost esx1 | select Name, VirtualSwitch, VLanId | | Export-Csv C:\VMHostNetworkInfo.csv

The full command line reference for Get-VirtualPortGroup is available here.