ESXi Shell Commands You Actually Use (ESXi 8 and ESX 9)

The ESXi shell commands admins really run over SSH, grouped by task: esxcli, vim-cmd, vmkping, esxtop and agent restarts, checked for ESXi 8 and ESX 9.

Short answer: the ESXi Shell commands you actually use fall into a small set: esxcli for host, network, storage and software state, vim-cmd for VMs when hostd works, vmkping for VMkernel connectivity and MTU tests, esxtop for live performance, and /etc/init.d/hostd restart or /etc/init.d/vpxa restart for stuck management agents. Enable SSH only for troubleshooting. Every esxcli command below exists in ESX 9.0 and in ESXi 8.0 U3 unless noted otherwise.

This is a curated list, grouped by task, not a full reference. For the complete namespace tree see ESXCLI commands for ESXi 8.0 and ESXCLI commands for ESX 9.0. Commands were checked against Broadcom’s ESXCLI Command Reference (8.0.3, 9.0.0 and 9.1.0); non-esxcli commands are taken from the Broadcom KB articles cited in each section. Placeholders: vmk0, vmnic0, datastore1, 10.0.0.10, naa.xxx.

Enable the ESXi Shell and SSH

The ESX Shell is deactivated by default and Broadcom recommends activating it for troubleshooting only. The shell is independent of lockdown mode: if the service is running, you can still log in to it even when the host is in lockdown mode. Two services matter: ESXi Shell (local console, Alt+F1) and SSH (remote, TCP 22).

  • vSphere Client: select the host, Configure > System > Services, select SSH or ESXi Shell, Edit Startup Policy > Start and stop manually, then Start.
  • Host Client: Manage > Services, select TSM (ESXi Shell) or the SSH service, Actions > Start.
  • DCUI: F2 > Troubleshooting Options > Enable ESXi Shell / Enable SSH. The same menu has Modify ESXi Shell and SSH timeouts.

Set a timeout so the service does not stay open. The availability timeout is the advanced option UserVars.ESXiShellTimeOut (seconds, 0 = disabled). To check SSH daemon settings from the shell:

esxcli system settings advanced list -o /UserVars/ESXiShellTimeOut
esxcli system ssh server config list

Sources: KB 311213 (Using ESXi Shell in ESXi), TechDocs Using the ESX Shell (9.0).

Host info and version

TaskCommand
Version and buildvmware -vl
Version, build, update levelesxcli system version get
Hostname and FQDNesxcli system hostname get
Vendor, model, serialesxcli hardware platform get
CPU packages, cores, threadsesxcli hardware cpu global get
Physical memoryesxcli hardware memory get
Uptime (microseconds)esxcli system stats uptime get
Time and NTPesxcli system time get; esxcli system ntp get
Boot deviceesxcli system boot device get
Disk and ramdisk usagedf -h; vdf -h

vmware -v / vmware -vl come from KB 345263 (determining the build number) and KB 323110; df -h and vdf -h (ramdisk usage, useful when /, /tmp or /var/log is full) from KB 318926 (investigating disk space).

Maintenance mode and reboot

esxcli system maintenanceMode get
esxcli system maintenanceMode set --enable true
esxcli system shutdown reboot --reason "Patching"
esxcli system maintenanceMode set --enable false

esxcli system shutdown reboot and poweroff take a --reason; the reference states the host must be in maintenance mode. On vSAN hosts, --vsanmode controls data evacuation; decide it before you enter maintenance mode, not after. Take a configuration backup first (vim-cmd hostsvc/firmware/sync_config then vim-cmd hostsvc/firmware/backup_config, KB 313510; details in Backup and restore ESXi host configuration data).

Networking

TaskCommand
Physical NICs, link, speed, driveresxcli network nic list
NIC details, firmware, driver versionesxcli network nic get -n vmnic0
NIC counters and errorsesxcli network nic stats get -n vmnic0
VMkernel interfaces, MTU, netstackesxcli network ip interface list
vmk IPv4 addressesesxcli network ip interface ipv4 get
vmk service tags (Management, vMotion…)esxcli network ip interface tag get -i vmk0
Routing tableesxcli network ip route ipv4 list
DNS serversesxcli network ip dns server list
Standard vSwitches and port groupsesxcli network vswitch standard list; esxcli network vswitch standard portgroup list
Distributed switches seen by the hostesxcli network vswitch dvs vmware list
VMs with active portsesxcli network vm list
ARP tableesxcli network ip neighbor list
Open connectionsesxcli network ip connection list
Firewall rulesetsesxcli network firewall ruleset list

vmkping and the MTU test

vmkping sends ICMP from a specific VMkernel interface. For a 9000 MTU path, use -d (do not fragment) and a payload of 8972 bytes (9000 minus 28 bytes of IP and ICMP headers); for 1500 use 1472. Add -S vmotion when the vmk is on the vMotion TCP/IP stack.

vmkping -I vmk1 10.0.0.10 -d -s 8972
vmkping -I vmk1 -S vmotion 10.0.0.10 -d -s 8972
vmkping -I vmk0 10.0.0.10 -d -s 1472 -c 3
esxcli network diag ping --host 10.0.0.10 --interface vmk1 --df --size 8972 --count 3

If 1472 works and 8972 fails, something in the path (vSwitch, uplink, physical switch port) is still at 1500. Sources: KB 313061 (testing jumbo frame pings), KB 344313 (testing VMkernel connectivity with vmkping). KB 313061 also lists esxcfg-vswitch -l and esxcfg-vmknic -l for a quick MTU overview.

Storage

TaskCommand
Devices (LUNs, NVMe, local disks)esxcli storage core device list
One deviceesxcli storage core device list -d naa.xxx
Paths and their stateesxcli storage core path list
Multipathing policy per deviceesxcli storage nmp device list
HBAsesxcli storage core adapter list
HBAs, detailed (9.0+)esxcli storage core adapter listdetailed
Rescan all adaptersesxcli storage core adapter rescan --all
Mounted datastores (VMFS, NFS, vSAN)esxcli storage filesystem list
VMFS extents to device mappingesxcli storage vmfs extent list
VAAI statusesxcli storage core device vaai status get -d naa.xxx
Manual UNMAP on VMFSesxcli storage vmfs unmap --volume-label datastore1
NFS v3 / v4.1 mountsesxcli storage nfs list; esxcli storage nfs41 list

Mount an NFS v3 datastore; --connections sets the number of TCP connections (nconnect, see nconnect support in the ESXi NFS client):

esxcli storage nfs add --host 10.0.0.10 --share /export/ds01 --volume-name nfs-ds01 --connections 4
esxcli storage nfs remove --volume-name nfs-ds01

Caution: storage vmfs unmap generates I/O on the array; run it outside peak hours. Do not remove an NFS datastore that still has registered or running VMs.

VMs from the shell

vim-cmd needs a responsive hostd. esxcli vm process works on the running VM world and is the fallback for a VM that ignores power operations.

TaskCommand
List registered VMs and their vmIDsvim-cmd vmsvc/getallvms
Power statevim-cmd vmsvc/power.getstate 12
Power on / guest shutdown / hard offvim-cmd vmsvc/power.on 12; vim-cmd vmsvc/power.shutdown 12; vim-cmd vmsvc/power.off 12
Snapshotsvim-cmd vmsvc/get.snapshot 12
Hung tasks of a VMvim-cmd vmsvc/get.tasklist 12
Register a VMvim-cmd solo/registervm /vmfs/volumes/datastore1/vm01/vm01.vmx
Running VMs with World IDesxcli vm process list
Kill a stuck VMesxcli vm process kill -t soft -w 2750434

Caution: use kill -t soft first, then hard, and force only as a last resort. If esxcli itself does not respond, Broadcom suggests localcli with the same syntax. Sources: KB 308360 (common VM tasks via CLI), KB 308457 (powering off an unresponsive VM).

Services and logs

/etc/init.d/hostd restart
/etc/init.d/vpxa restart
tail -f /var/log/hostd.log
tail -f /var/log/vmkernel.log

Restart hostd or vpxa individually when the host shows as disconnected or not responding in vCenter, then wait 1–2 minutes. Caution: Broadcom warns not to use services.sh restart (or Restart Management Agents in the DCUI) on hosts running vSAN, LACP, NSX, or shared graphics (vGPU, vDGA, vSGA); restart single services instead. Source: KB 320280 (restarting management agents).

TaskCommand
Syslog configurationesxcli system syslog config get
Set remote syslog targetesxcli system syslog config set --loghost udp://10.0.0.10:514
Apply syslog changesesxcli system syslog reload
Write a marker into all logsesxcli system syslog mark --message "start of test"
Advanced settings changed from defaultesxcli system settings advanced list --delta
Core dump targetesxcli system coredump partition get; esxcli system coredump file list

Performance: esxtop basics

Run esxtop in the SSH session and switch views with single keys: c CPU, m memory, n network, d disk adapter, u disk device, v disk per VM, V show only VMs, f fields, h help, q quit.

For support cases, collect batch data to a datastore (-b batch, -a all metrics, -d interval in seconds, -n number of samples). 300 samples at 2 s = 10 minutes:

esxtop -b -a -d 2 -n 300 > /vmfs/volumes/datastore1/esxtop-$(hostname)-$(date +"%FT%H:%M").csv

Make sure the target datastore has free space and is not the one you are troubleshooting. Sources: KB 382249 (using esxtop), KB 370279 (collecting esxtop batch data).

Software and VIBs

TaskCommand
Base image (ESXi version in the image)esxcli software baseimage get
Installed componentsesxcli software component list
Installed VIBsesxcli software vib list
One VIB in detailesxcli software vib get -n <vib-name>
Image profileesxcli software profile get
Host acceptance levelesxcli software acceptance get
Verify VIB signaturesesxcli software vib signature verify
Profiles in an offline depotesxcli software sources profile list -d /vmfs/volumes/datastore1/depot.zip
Dry-run a component installesxcli software component apply -d /vmfs/volumes/datastore1/component.zip --dry-run

--dry-run exists on component apply, vib install, vib remove and profile update; use it before every change. On vLCM-managed clusters, remediate from vCenter instead. A quick check for NSX VIBs before any management-agent restart: esxcli software vib list | grep -E 'nsx|vsipfwlib'.

ESX 9 notes

ESX 9.0 adds two top-level namespaces, licensing and nsx; 9.1 adds memtier. None exist in 8.0 U3, and memtier is not in 9.0.

TaskCommand
License credentials (9.0+)esxcli licensing credential list
License entitlement assignments (9.0+)esxcli licensing entitlement list
Stop NSX services (9.0+)esxcli nsx services stop
Memory tiering status (9.1)esxcli memtier status get
Memory tiering devices (9.1)esxcli memtier device list
Memory tiering configuration (9.1)esxcli memtier config get

Caution: the reference describes esxcli nsx services stop as stopping NSX services with the tn-delete option. It is not a diagnostic command; use it only under an NSX procedure or support guidance. Other 9.0 additions worth knowing: esxcli storage core adapter listdetailed, esxcli nvme auth get and the esxcli vsan dedup namespace. The full diff is in ESXCLI changes from ESXi 8.0 U3 to ESX 9.0 and 9.1.

Full command lists

For the complete list see the full ESX 9.0 ESXCLI list and the ESXCLI 8.0 mindmap.

Sources

Related on vdan.cz

Author: Daniel Micanek

Senior Service Architect, SAP/TDL Platform Services Team at Vivicta | vExpert ⭐⭐⭐⭐⭐⭐⭐ | Broadcom Knight: vSphere Kubernetes Service, VCF Networking (NSX), VCF Automation | Broadcom Software Knight: vSphere | Cisco Champion. Notes from running about 1,000 ESXi hosts on Cisco UCS, VCF 9 and SAP HANA on vSphere.