Useful commands VMWare ESXi

Reference list of useful VMWare ESXi console commands (including ESXCLI), which is often used in troubleshooting and fine-tuning the hypervisor. As required, the list of commands will be expanded and updated.

The available ESXi console commands can be viewed in the / usr / sbin directory.

cd / usr / sbin
ls

Council Note that all esxi commands are case-sensitive.

Related : Virtual Machine disks consolidation is needed

The full list of esxcli commands can be displayed using the command:

esxcli esxcli command list

To start the ESXi commands that you can perform via ssh access.

  • reboot – reboot host
  • poweroff – turn off the host
  • esxcli system version get – find out the version (number) of the installed version of VMware ESXi
  • uname -a – also find out the version of VMware ESXi
  • find out the version of VMware ESXi
  • vmware –vl – and another way to find out the version and release of VMware ESXi
  • get the installed version number of ESXi
  • esxcli hardware pci list | more – complete information about installed PCI devices
  • lspci – summary of all installed PCI devices
  • esxtop – top process manager for vmware esxi (shortcut keys for switching the display: c: cpu, i: interrupt, m: memory, n: network, d: disk adapter, u: disk device, v: disk VM, p: power mgmt )
  • vmkerrcode -l – decoding error codes
  • esxcfg-nics -l – information about network cards
  • esxcfg-vswitch -l – information about virtual switches
  • find. -name libstorelib.so – find the file libstorelib.so


file search on ESXi

 

  • dcui – working with server console via ssh session
  • chkconfig -l – daemon work status
  • esxcli hardware memory get – the size of the installed memory
  • esxcli software vib list – list of installed vib packages
  • esxcli network ip connection list – the status of active connections (similar to netstat)
  • esxcli storage vmfs extent list – information about mounted / mounted VMFS volumes
  • esxcli hardware clock (get / set) – display / set the time of the esxi host
  • cd – Change the current directory;
  • cp – Copy the file .cp [file 1] [file2];
  • find – Search files by criteria;
  • ls – List of files and directories in the current or explicitly specified directory. Mls / vmfs / volumes / keys: -l detailed information -a show hidden files;
  • mkdir – Create directory;
  • mv – Moving a file. Rename file.mv [path and file name] [path where to move];
  • ps – Information about running processes. ps -ef;
    rm – Delete files;
  • shutdown – Shutdown or restart server shutdown nowshutdown –r now;
  • vi – Text editor;
  • nano – Beginner-friendly text editor, absent on ESXi;
  • cat – Displays the contents of the file on the screen. cat / etc / hosts;
  • more – Displays the contents of the file on the screen, one page at a time. more / etc / hosts;
  • man – Help on man commands , for some commands, help is displayed when the command is run without parameters;
  • useradd – Create user. useradd ;
  • passwd – Set password to user passwd ;
  • esxcli storage nfs list – list of connected nfs storage on the host
  • esxcli software vib list – a list of installed vib packages
  • esxcli hardware memory get – information about memory usage on an ESXi host, including total RAM
  • esxcli hardware cpu list – information on the number of processors on an ESXi host
  • esxli iscsi adapter list – list of iSCSI adapters and their names
  • esxcli network nic list – list of network adapters
  • esxcli network ip interface list – Host IP interface information
  • esxcli network ip dns search list – DNS settings information
  • ist – Status of active connections (netstat analog)


network neighbors list – # Output ARP Table

  1. esxcli network firewall get
  2. esxcli network firewall ruleset list – ESXi firewall status (firewall) and active rules for ports and services;
  3. esxcli storage vmfs extent list – Information about VMFS partitions connected to a host
  4. esxcli storage filesystem list – Map VMFS volumes to devices
  5. esxcli storage core path list
  6. esxcli storage core device list – Displaying information about paths and devices on the Fiber Channel (FC)
  7. esxcli storage core plugin list – List of NMP plugins loaded into the system
  8. esxcli storage core adapter rescan – Run rescan HBA adapters
  9. esxcli vm process list – we get the virtual machine ID
  10. esxcli vm process kill –type = [soft, hard, force]
  11. esxcli system welcomemsg get
  12. esxcli system welcomemsg set – Get text and change ESXi welcome message
  13. esxcli system settings advanced list | grep smth – Search anything in Host Advanced Settings
  14. esxcli hardware clock get – Current host hardware time
  15. esxcli hardware bootdevice list – Device boot order
  16. esxcli hardware pci list – List of PCI devices
  17. esxcli iscsi adapter discovery rediscover – Scanning iSCSI adapters
  18. esxcli storage core adapter rescan [-A | -all] – Rescan iSCSI

Commands for working with virtual machines:

  1. vim-cmd vmsvc / getallvms – information output about all VM
  2. vim-cmd vmsvc / power.getstate 1 – enable / disable VM with Vmid 1
  3. vim-cmd vmsvc / power.on 1 – enable VM with Vmid 1
  4. vim-cmd vmsvc / power.off 1 – turn off (power on) VM with Vmid 1
  5. vim-cmd vmsvc / power.reset 1 – reboot (similar to pressing the RESET key on a real server) VM with Vmid 1
  6. vim-cmd vmsvc / power.shutdown 1 – correct shutdown of a VM with Vmid 1. Valid only if VMware Tools are installed!
  7. vim-cmd vmsvc / power.reboot 1 – reboot the VM with Vmid 1. Valid only if VMware Tools are installed!
  8. vim-cmd vmsvc / get.summary 1 – get complete VM information with Vmid 1.
  9. vim-cmd vmsvc / get.summary 1 | egrep ‘(name | power | ip)’ – get filtered VM information from Vmid 1. Name, power status, IP address are displayed
  10. vim-cmd vmsvc

Having typed this command, you will see all possible options for its use. Below is a list of commands that seemed useful to me:

  1. vim-cmd vmsvc / power.getstate the power status of the virtual machine with the specified ID. You can see the list of VMs and their IDs with the help of the command;
  2. vim-cmd vmsvc / getallvms – Power off the virtual machine;
  3. vim-cmd vmsvc / power.off vmid – Enable power to the virtual machine;
  4. vim-cmd vmsvc / power.on vmid – Restart the virtual machine;
  5. vim-cmd vmsvc / power.reboot vmid – Delete virtual machine files;
  6. vim-cmd vmsvc / destroy vmid – Delete virtual machine files;
  7. vim-cmd vmsvc / power.shutdown – Shut down the virtual machine (shutdown guest);
  8. vim-cmd vmsvc / power.reset – Reboot the virtual machine;
  9. vim-cmd vmsvc / get.summary – General information about the virtual machine;
  10. vim-cmd solo / registervm /vmfs/vol/datastore/dir/vm.vmx – Connect a virtual machine;
  11. vim-cmd vmsvc / unregister vmid – Remove a virtual machine from the hypervisor;
  12. vim-cmd vmsvc / tools.install vmid – Install vmware tools;
  13. vim-cmd hostsvc / net / info – information about the hypervisor network;
  14. vim-cmd hostsvc / maintenance_mode_enter – Switch the host to maintenance mode;
  15. vim-cmd hostsvc / maintenance_mode_exit – Exit maintenance mode;
  16. chkconfig -l – Show services running on the hypervisor;
  17. esxtop – List of processes;
  18. vmkerrcode -l – see vmkernel errors;
  19. esxcfg-info – View host information;
  20. esxcfg-nics -l – View information about network adapters;
  21. esxcfg-vswitch -l – View information about virtual network adapters;
  22. dcui – ESXI Startup Console for ssh;
  23. vsish – Vmware interactive console;
  24. cat /etc/chkconfig.db – view the status of services on the host;
  25. /sbin/services.sh restart – restart all services on the host;
  26. vmkload_mod –list – Show loaded drivers;
  27. vmkload_mod -s / mod / your_driver – Show driver options;
  28. vmkfstools -i /vmfs/volumes/san_vmfs/my_vm/large_disk.vmdk -d thin /vmfs/volumes/san_vmfs/my_vm/new_thin_disk.vmdk – Convert an existing disk to a thin format;

If you want inspire us to write new blogs please share this post with your friends and support us :)