Getting to know ESXCLI commands and how to use

Posted by on August 3, 2012 in CLI, VMware | 1 comment

I will open this up by saying I come from a Windows background so my use for the command line has always been low. I can fumble my way around but since I no longer use it everyday my skills are somewhat rusty. My coworker and fellow blogger at the Wahlnetwork probably is laughing about my 20 years in IT and thinks the guy in the image below is me.

So on to the serious stuff, if you are needing learn more on the ESXCLI commands for your daily work, just for fun or maybe you are studying for the VCAP-DCA exam then hopefully I can point you in the right direction. First thing I would say is remove any fear that you might have about the big bad command line, its not that scary. The best way to learn and eventually mast this is to start forcing yourself to work in it on a daily basis. I’m going to assume that you know how to access the command line or ESXi shell already if not have a read of how to become a Shell Ninja to get you started.

How to find ESXCLI commands

The first thing your thinking is geez how to do I find the command that I need to use? Well you can look them up in the VMware documentation here or you can use the command line (CLI) to figure them out. First thing is you can simply type the following command in and ESXCLI will spit out what the possible variables are.

# esxcli

It will then show you help on the possible options that the command offers. I am working on ESXi 5.0U1 for this post and as of now these are the options for the command. It seems like VMware will continue to build more functions and roll in the old esx commands. But right now you can configure the following main areas with the ESXCLI command.

  • FCOE
  • Hardware
  • Network
  • Storage
  • VMs
  • iSCSI
  • Software
  • System

How to get a list of all ESXCLI commands

Well now that you know how to use the help feature of ESXCLI, you are probably wondering how you would get a list of all the possible commands. We you could definitely go off and Google for the VMware documentation and find a list or you could just use the following command. I’m adding the |more to the end so that the list does not go flashing before your eyes. This is an option that you can use on almost any command that will show you more than a screen full of data.

# esxcli esxcli command list |more

How to work with a ESXCLI command

Now that you know how to use help and get a list of all the possible commands you are on your way to working with your first command. Lets work with the Network command to see what we can accomplish.

Start out by typing and you will see the help like the image shown below.

# esxcli network

From here we can see that you can work with the firewall, IPs, vswitches and nics. Lets have a look and see what we can do with a nic using this command.

# esxcli network nic

So from the image above using the “nic” option we can see that it looks like we can bring a physcial nic connection up or down, list out info and change settings.

Lets have a look at what the list function will show us.

# esxcli network nic list

You can see from the image below the command is showing us details about the physical network adapters in our host. This is a very helpful command to gather info you might need before changing settings with another command or to verify that a setting that you just changed is now active.

Now lets have a look at how we could get more details using the “nic get” part of the command.

# esxcli network nic get

This will show you the help as shown in the image below. The command errors and shows you help saying that you will need to specify the NIC that you want to get info about.


Now that we know the switches that we need to pull detailed info about vmnic0 that we looked up when we did the list command a few steps earlier.

# esxcli network nic get -n vmnic0

Once you use the command above you will get detailed information about the NIC that you specified. The command will display more details than the list command that you used earlier.


What do you do now?

Well at this point you are probably thinking well there are a lot of commands in that list and yes there are. It will take you awhile to master them but you now posses some of the skills to get you started. If you follow these basic starter methods you can also stumble your way through the CLI landscape. Some are probably going to say this is a noob way to work with this but if you are new or don’t use the CLI on a regular basis this approach can help you figure out what command and input you need to provide to accomplish your goal.

So I may not be a Ninja like Chris Wahl but maybe I have trained hard and deserve to be a Beverly hills Ninja like Chris Farley.


About Brian Suhr

Brian is a VCDX5-DCV and a Sr. Tech Marketing Engineer at Nutanix and owner of this website. He is active in the VMware community and helps lead the Chicago VMUG group. Specializing in VDI and Cloud project designs. Awarded VMware vExpert status 6 years for 2016 - 2011. VCP3, VCP5, VCP5-Iaas, VCP-Cloud, VCAP-DTD, VCAP5-DCD, VCAP5-DCA, VCA-DT, VCP5-DT, Cisco UCS Design

1 Comment

  1. The following esxcli reference may be helpful:

Leave a Comment

Your email address will not be published. Required fields are marked *