6.0

Table Of Contents
Getting Started with vSphere Command-Line Interfaces
34 VMware, Inc.
Examples
YoucanusevifstointeractwiththeremoteESXiorvCenterServersysteminavarietyofways.Specifyone
oftheconnectionoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<conn_options>.TheexamplesillustrateuseonaLinuxsystem,usedouble
quotesinsteadof
singlequoteswhenonaWindowssystem.
Listing Remote Information
ListalldatacentersonavCenterServersystemwith--listdc,using--servertopointtothevCenter
Serversystem.
vifs --server <my_vc>--username administrator --password <pswd> --listdc
ListalldatastoresonavCenterServersystemwith--listds.
vifs --server <my_vc> --username administrator --password <pswd> --dc kw-dev --listds
ListalldatastoresonanESXihostwith--listds.
vifs --server <my_ESXi> --username root --password <pswd> --listds
Thecommandliststhenamesofalldatastoresonthespecifiedserver.
Youcanuseeachnamethathasbeenreturnedtorefertodatastorepathsbyusingsquarebracketnotation,
asfollows:
'[my_datastore] dir/subdir/file'
Listthecontentofadirectoryinadatastore.
vifs --server <my_ESXi> --username root --password <pswd>--dir '[Storage1]'
vifs --server <my_ESXi> --username root --password <pswd> --dir '[Storage1] WindowsXP'
Thecommandliststhedirectorycontent.Inthisexample,thecommandliststhecontentsofavirtual
machinedirectory.
Content Listing
_________________
vmware-37.log
vmware-38.log
...
vmware.log
...
winxpPro-sp2.vmdk
winxpPro-sp2.vmx
winxpPro-sp2.vmxf
...
Listthecontentsofoneofthedatastores.
--move
-m <source>
<target>
Movesafileinadatastoretoanotherlocation
inadatastore.The<source>mustbearemote
sourcepath,the<target>aremotetarget
pathordirectory.
The--forceoptionreplacesexisting
destinationfiles.
Datastore
Temp
move src_file_path
dst_directory_path
[‐‐force]
move src_file_path
dst_file_path [‐‐force]
--put
-p <local_path>
<remote_path>
Uploadsafilefromthemachine
onwhichyou
runvCLItotheESXihost.Thisoperationuses
HTTP PUT.
Thiscommandcanreplaceexistinghostfiles
butcannotcreatenewfiles.
Datastore
Host
Temp
put src_local_file_path
dst_file_path
put src_local_file_path
dst_directory_path
--rm
-r <remote_path>
Deletesadatastorefile. Datastore
Temp
rm dst_file_path
--rmdir
-R <remote_dir>
Deletesadatastoredirectory.Thisoperation
failsifthedirectoryisnotempty.
Datastore
Temp
rmdir dst_directory_path
Command Description Target Syntax