The top 25 ESX commands and ESXi commands
The top Linux commands
The ESX service console is based on Red Hat Linux and therefore many Linux commands can be used inside it. Here are common Linux commands and some VMware-specific versions of them.
- Find/cat/grep commands find, display and search for files. Find locates specific files, cat displays the contents of files and joins files together, and grep searches for specific text within in a file. These commands help administrators find specific infrastructure elements such as snapshot files and also display log and config files. They can also search for information within files.
- Tail displays the last part of a text-based file and can also monitor output to the file in real time. This command helps monitor log files in real time.
- Service can start, stop and restart services (or programs) that run on the host server. Some common ESX services include mgmt-vmware, vmware-vpxa, firewall, vmware-hostd and vmware Web Access. This command can restart services that hang or following configuration changes.
- Nano and vi edit text files. Nano is a simpler and easier to use editor than is vi, but vi is a more featured and powerful editor. Text editors help edit configuration files on an ESX host.
- Su and sudo commands help control access and prevent the root account from being used.Su elevates the privileges of less privileged user accounts to that of a superuser (or root). Sudo runs commands as another user as specified in the sudoers configuration file.
- ls lists file and directory information. By using certain switches (e.g., ltr) you can display detailed file information, including the owner, size, permissions and the last modified date andtime.
- Df and vdf display file system (partitions) information, including free space. Thedf command will not display Virtual Machine File System (VMFS) volumes because it cannot read them. Vdf is the VMware version of this command, which will also display VMFS volume information. Both commands can use the H switch, which displays the output in readable form (i.e., as 2 GB rather than as 2,016,044).
- Ps and kill commands can forcibly terminate stuck VMs that will not power on or off.Ps displays the status or processes running on the host. It can use many switches, but the most common is EF, which displays full information about every process running. The killcommand is often used with the ps command to terminate specific running processes.
- Ping and vmkping are the most basic network troubleshooting commands. Ping tests network connectivity with other hosts and network devices by sending an Internet Control Message Protocol packet to them and seeing the response. Vmkping is the VMware-specific version of the Ping command. It uses the IP stack of the VMkernel to ping another ESX host’s VMkernel port. This command helps troubleshoot VMotion and network storage issues.
The top VMware ESX commands and ESXi commands
These VMware ESX and ESXi commands can be run with the ESX service console (locally or remotely using Secure Shell) or with RCLI (in VMware Infrastructure 3) and vSphere CLI (in vSphere). With the RCLI and vSphere CLI, note that many of the commands have been renamed to vicfg- instead of esxcfg- (i.e., esxcfg-nics.pl and vicfg-nics.pl). Both commands perform the same function, but VMware is trying to migrate from esxcfg- to vicfg-.
- The versatile vmkfstools command is the Swiss army knife of virtual disks and can be used to copy, convert, rename, import, export and resize virtual disk files.
- Esxtop troubleshoots performance problems. It provides real-time and historical performance statistics for CPU, memory, disk and network usage.
- Esxcfg-nics views and configures physical network interface cards (NICs). It displays NIC status and can configure speed and duplex of the NICs.
- Esxcfg-vswitch views and configures virtual switches. It’s useful for configuring networking when the vSphere Client cannot be used. The command configures port groups and links physical NICs to them (known as uplinks) anad configures virtual LAN IDs, Cisco Discovery Protocol (CDP) and the MTU of vswitches.
- Esxcfg-vswif and esxcfg-vmknic allow you to view and configure special port groups on vSwitches. Esxcfg-vswif configures the ESX service console network interfaces, which are also known as vswif ports. Esxcfg-vmknic configures VMkernel network interfaces, which are necessary for VMotion and connecting to iSCSI and Network File System network storage devices.
- Vmware-cmd is a versatile command to manage and retrieve information from virtual machines. It can change VM power states, manage snapshots, register and unregister VMs, and retrieve and set various VM information.
- Vimsh and vmware-vim-cmd are complex commands that you should fully understand before using. Vimsh is a powerful interactive shell that allows execution of commands and the ability to display and configure many things. VMware-vim-cmd is a front end of sorts for vimsh that simplifies command usage without having to know the many switches that vimsh requires.
- Vihostupdate and esxupdate update and patch ESX and ESXi hosts. Esxupdate is used on the ESX service console and vihostupdate is used by the RCLI/vSphere CLI. In addition,vihostupdate35 is used to patch ESX and ESXi version 3.5 hosts.
- Svmotion is an RCLI/vSphere CLI command used to initiate Storage VMotion sessions to relocate a VM’s virtual disk to another datastore while it is running. In ESX 3.5 this command was the only method to initiate a SVMotion; in vSphere the ability to do this was added to the vSphere Client GUI.
- Esxcfg-mpath displays and sets all paths from a host to its storage devices.
- Esxcfg-rescan lets a host res-can a particular storage adapter to discover new storage devices. This tools is useful when storage devices have been added, removed or changed from a storage network.
- Esxcfg-scsidevs and esxcfg-vmhbadevs display information on the storage devices connected to a host. Esxcfg-vmhbadevs was used in ESX 3.5 and was replaced byesxcfg-scsidevs in vSphere.
- Esxcfg-firewall displays information and configures the built-in firewall that protects the ESX service console. It allows and blocks specific TCP/IP ports between the service console and other network devices.
- The esxcfg-info command provides a wealth of information about the host that it is run on. It can be re-directed to a text file to document host configuration.
- Esxcfg-auth configures Service Console authentication on an ESX host. It can configure authentication to a third-party LDAP or Active Directory server and set various local security options.
- Vm-support is a powerful information gathering tool commonly used in troubleshooting. The command gathers up a large amount of configuration info, log files and the output from many commands into a single .tgz archive file. It can also be used to display VM information as well as kill VMs that are not responding.
Most of the above commands have various syntaxes, options and switches that can be used with them. With them you can usually run a command without any options. For more information on these 25 ESX and ESXi commands, check out the following documentation: