100+ 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
Learn 100+ Useful commands VMWare ESXi
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
- esxcli network firewall get
- esxcli network firewall ruleset list – ESXi firewall status (firewall) and active rules for ports and services;
- esxcli storage vmfs extent list – Information about VMFS partitions connected to a host
- esxcli storage filesystem list – Map VMFS volumes to devices
- esxcli storage core path list
- esxcli storage core device list – Displaying information about paths and devices on the Fiber Channel (FC)
- esxcli storage core plugin list – List of NMP plugins loaded into the system
- esxcli storage core adapter rescan – Run rescan HBA adapters
- esxcli vm process list – we get the virtual machine ID
- esxcli vm process kill –type = [soft, hard, force]
- esxcli system welcomemsg get
- esxcli system welcomemsg set – Get text and change ESXi welcome message
- esxcli system settings advanced list | grep smth – Search anything in Host Advanced Settings
- esxcli hardware clock get – Current host hardware time
- esxcli hardware bootdevice list – Device boot order
- esxcli hardware pci list – List of PCI devices
- esxcli iscsi adapter discovery rediscover – Scanning iSCSI adapters
- esxcli storage core adapter rescan [-A | -all] – Rescan iSCSI
Commands for working with virtual machines:
- vim-cmd vmsvc / getallvms – information output about all VM
- vim-cmd vmsvc / power.getstate 1 – enable / disable VM with Vmid 1
- vim-cmd vmsvc / power.on 1 – enable VM with Vmid 1
- vim-cmd vmsvc / power.off 1 – turn off (power on) VM with Vmid 1
- vim-cmd vmsvc / power.reset 1 – reboot (similar to pressing the RESET key on a real server) VM with Vmid 1
- vim-cmd vmsvc / power.shutdown 1 – correct shutdown of a VM with Vmid 1. Valid only if VMware Tools are installed!
- vim-cmd vmsvc / power.reboot 1 – reboot the VM with Vmid 1. Valid only if VMware Tools are installed!
- vim-cmd vmsvc / get.summary 1 – get complete VM information with Vmid 1.
- vim-cmd vmsvc / get.summary 1 | egrep ‘(name | power | ip)’ – get filtered VM information from Vmid 1. Name, power status, IP address are displayed
- 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:
- 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;
- vim-cmd vmsvc / getallvms – Power off the virtual machine;
- vim-cmd vmsvc / power.off vmid – Enable power to the virtual machine;
- vim-cmd vmsvc / power.on vmid – Restart the virtual machine;
- vim-cmd vmsvc / power.reboot vmid – Delete virtual machine files;
- vim-cmd vmsvc / destroy vmid – Delete virtual machine files;
- vim-cmd vmsvc / power.shutdown – Shut down the virtual machine (shutdown guest);
- vim-cmd vmsvc / power.reset – Reboot the virtual machine;
- vim-cmd vmsvc / get.summary – General information about the virtual machine;
- vim-cmd solo / registervm /vmfs/vol/datastore/dir/vm.vmx – Connect a virtual machine;
- vim-cmd vmsvc / unregister vmid – Remove a virtual machine from the hypervisor;
- vim-cmd vmsvc / tools.install vmid – Install vmware tools;
- vim-cmd hostsvc / net / info – information about the hypervisor network;
- vim-cmd hostsvc / maintenance_mode_enter – Switch the host to maintenance mode;
- vim-cmd hostsvc / maintenance_mode_exit – Exit maintenance mode;
- chkconfig -l – Show services running on the hypervisor;
- esxtop – List of processes;
- vmkerrcode -l – see vmkernel errors;
- esxcfg-info – View host information;
- esxcfg-nics -l – View information about network adapters;
- esxcfg-vswitch -l – View information about virtual network adapters;
- dcui – ESXI Startup Console for ssh;
- vsish – Vmware interactive console;
- cat /etc/chkconfig.db – view the status of services on the host;
- /sbin/services.sh restart – restart all services on the host;
- vmkload_mod –list – Show loaded drivers;
- vmkload_mod -s / mod / your_driver – Show driver options;
- 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;