VMware ESXi Command Line Cheat Sheet

Below we list over 120+ common and useful CLI commands (including esxcli) for VMware ESXi Host and VM management. Keep in mind, these shell commands are to be ran at the host CLI, not from the VCSA command line.

Knowing how to work with ESXi CLI commands is an underappreciated skill as a system administrator or infrastructure engineer. Command-line access grants you the ability to configure settings not available in the GUI (of which there are still many), providing greater flexibility in managing your VMware ESXi environment. It significantly enhances your troubleshooting capabilities by allowing you to access detailed system information, logs, and performance metrics quickly. The CLI also enables automation through scripting for handling repetitive tasks, saving you time and streamlining routine maintenance tasks.

Free ESXi CLI Cheat Sheet

Screenshot showing vmware esxi command line cheat sheet preview

Click cheat sheet to view the printable, searchable PDF version.

Feel free to print it out and hang it up or share a link to it with your colleagues and peers.

General

Get ESXi build and version numbers

esxcli system version get

Get host hostname, domain, and FQDN

esxcli system hostname get

Get date and time ESXi was installed

esxcli system stats installtime get

List local users on ESXi host

esxcli system account list

Create local ESXi user

esxcli system account add -d="Description" -i="username" -p="password" -c="password"

List available commands with descriptions

esxcli command getdetails

List all available namespaces with corresponding commands

esxcli esxcli command list

Check maintenance mode

esxcli system maintenanceMode get

Enable/Disable maintenance mode

esxcli system maintenanceMode set –enable true

Reboot/Restart ESXi host

esxcli system shutdown reboot -r "message"

Reboot/Restart ESXi maintenance mode host with countdown timer

esxcli system shutdown reboot -d 10 -r "Patch Updates"

Get CPU information of host (family, model, and cache)

esxcli hardware cpu list

Get memory information (available and non-uniform memory access)

esxcli hardware memory get

Configuration of and information about syslog

esxcli system syslog

Generate support and log information bundle from host

vm-support

Management

Restart Management, HA Services (change to /sbin/services directory)

restart

List Virtual Machines (VMIDs)

vim-cmd vmsvc/getallvms

List running VMs with world ID

esxcli vm process list

Terminate running VM process (forcibly powers off VM)

esxcli vm process kill

Power On

vim-cmd vmsvc/power.on

Power Off (Soft)

vim-cmd vmsvc/power.off

Power Off (Hard)

esxcli vm process kill -w [worldID] -t [soft,hard,force]

Reboot VM

vim-cmd vmsvc/power.reboot

Suspend VM

vim-cmd vmsvc/power.suspend

Resume VM

vim-cmd vmsvc/power.suspendResume

Reset VM

vim-cmd vmsvc/power.reset

Shutdown VM

vim-cmd vmsvc/power.shutdown

Show VM info summary

vim-cmd vmsvc/get.summary

Check Host Performance

esxtop

Check storage I/O performance

vscsiStats

Install Software

Lists currently installed software and drivers (VIBs) on ESXi

esxcli software vib list

Install package (VIB)

esxcli software vib install -v file:/tmp/[NewVIB].vib

Uninstall VIB

esxcli software vib remove -n VIBname

Update installed VIB on ESXi

esxcli software vib update -d “/tmp/update.zip”

Install patch

esxcli software vib install /tmp/[patchName].zip

Virtual Disks

Extend virtual disk

vmkfstools -X 1500G /vmfs/volumes/exampledatastore/Example/Example.vmdk

Rename disk

mv Name.vmdk Name_changed.vmdk

Clone disk

vmkfstools -i Name_changed.vmdk -d zeroedthick Name_changed_clone.vmdk

Remove disk

rm Name.vmdk

Jump to directory of VM and monitor activity of delta, flat, and sesparse files

cd /vmfs/volumes/esxdatastore0/vm/vmfs/volumes/510a4e43-4bf56f05-5a34-0034791e8a3/vm # watch -d 'ls -luth | grep -E "delta|flat|sesparse"'

Delete all snapshots and power off VM. Convert thick provisioned disk to thin disk.

vmkfstools -i /vmfs/volumes/exampledatastore/vm/diskname.vmdk -d thin /vmfs/volumes/exampledatastore/vm/diskname-thin.vmdk

Delete VM thick disk

rm /vmfs/volumes/exampledatastore/vm/diskname-flat.vmdk.thick

Determine configured size of thin disk

ls -lh /vmfs/volumes/exampledatastore/vm/diskname-flat.vmdk

Determine used size of thin disk

du -h /vmfs/volumes/exampledatastore/vm/diskname-flat.vmdk

Snapshots

List all VM snapshots

vim-cmd vmsvc/snapshot.get

Create snapshot for running VM

vmware-cmd vmsvc/snapshot createsnapshot "New Snaphot Name" "Snapshop Description"

Create snapshot for running VM, with RAM

vim-cmd vmsvc/snapshot.create "New Snaphot Name" "Snapshop Description" includeMemory

Delete a snapshot

vim-cmd vmsvc/snapshot.remove

Monitor deleting of snapshot from VM on host

vim-cmd vimsvc/task_list (to get task ID)
vim-cmd vimsvc/task_info <task ID>

Remove all snapshots

vmware-cmd /vmfs/volumes/local0/Example/Example.vmx removesnapshots

Check if volume is native snaphot capable

vmkfstools -Ph /vmfs/volumes/exampledatastore/

Networking

List VM networking information

esxcli network vm list

Get IPv4 configuration for all interfaces on host

esxcli network ip interface ipv4 get

Get firewall state

esxcli network firewall get

Disable firewall

esxcli network firewall set –enabled true | false

Get firewall rules

esxcli network firewall ruleset list

Get firewall rules piped to awk

esxcli network firewall ruleset list | awk '$2 =="true"'

Activate ESXi Firewall Ruleset

esxcli network firewall ruleset set --ruleset-id=sshClient --enabled=true

Specify allowed IP Range for SSH

esxcli network firewall ruleset allowedip add --ruleset-id sshServer --ip-address 10.10.0.0/24

List Kernel Network Interfaces

esxcli network ip interface list

List physical Network Interfaces

esxcli network nic list

Shutdown physical network interface

esxcli network nic down -n

List host routing table

esxcli network ip route ipv4 list

Add static route to esxi host

esxcli network ip route ipv4 add --gateway 10.10.1.1 --network 10.10.0.0/24

Set ESXi host default gateway

esxcfg-route -a default 192.168.254.1

Test ESXi host default gateway

vmkping -D

Send ICMP request

vmkping –I

Test host connectivity to specific port

nc –z

List arp cache

esxcli network ip neighbor list

Clear arp cache entry

esxcli network ip neighbor remove -a -v

List virtual switches

esxcli network vswitch standard list

Change physical uplink of vSwitch

esxcli network vswitch standard uplink remove -u -v
esxcli network vswitch standard uplink add -u -v

List portgroups

esxcli network vswitch standard portgroup list

Add new portgroup to vSwitch

esxcli network vswitch standard portgroup add -p "Portgroup_Name -v

Set Management Network Interface

esxcli network ip interface tag add -i -t Management

Set VLAN id

esxcli network vswitch standard portgroup set --vlan-id -p "Portgroup_Name"

Set SNMP Community

esxcli system snmp set --communities "COMMUNITY_NAME"

Set SNMP Trap destintion

esxcli system snmp set --targets 10.10.1.150/COMMUNITY_NAME

Send test SNMP trap

esxcli system snmp test

Check SNMP State

esxcli system snmp get

Enable IPMI as SNMP source

esxcli system snmp set --hwsrc sensors

Enable CIM as SNMP source

esxcli system snmp set --hwsrc indications

Enable ESXi Host SNMP

esxcli system snmp set --enable true

Capture Network Packets on the a physical interface

pktcap-uw --uplink

List all physical network interfaces

esxcli network nic list

Enable iSCSI software adapter

esxcli iscsi software set –enabled true

Verify iSCSI adapter is enabled

esxcli iscsi software get

List metrics for specific iSCSI adapter

esxcli iscsi adapter param get -A

List established iSCSI sessions

esxcli iscsi sessions

Storage

List current storage devices

esxcli storage core device list

List all storage devices accessib