vmware vmrun命令簡介

2021-08-07 09:49:40 字數 3635 閱讀 6712

1、簡介

vmware提供了vmrun與vix api兩種手段使使用者可以通過程式對虛擬機器進行控制。vmrun是一種命令列控制的手段,但是可以通過shell指令碼實現連續多個操作的自動化。

2、語法

usage: vmrun command [parameters]

authentication flags

-gu

-gp

power commands           parameters           description

start                    path to vmx file     start a vm or team

or vmtm file

[gui|nogui]

stop                     path to vmx file     stop a vm or team

or vmtm file

[hard|soft]

reset                    path to vmx file     reset a vm or team

or vmtm file

[hard|soft]

suspend                  path to vmx file     suspend a vm or team

or vmtm file

[hard|soft]

snapshot commands        parameters           description

listsnapshots            path to vmx file     list all snapshots in a vm

snapshot                 path to vmx file     create a snapshot of a vm

snapshot name

deletesnapshot           path to vmx file     remove a snapshot from a vm

snapshot name

reverttosnapshot         path to vmx file     set vm state to a snapshot

snapshot name

guest os commands        parameters           description

runprograminguest        path to vmx file     run a program in guest os

program

[program arguments]

fileexistsinguest        path to vmx file     check if a file exists in guest os

path to file in guest

setsharedfolderstate     path to vmx file     modify a host-guest shared folder

share name

new host path

addsharedfolder          path to vmx file     add a host-guest shared folder

share name

host path

removesharedfolder       path to vmx file     remove a host-guest shared folder

share name

listprocessesinguest     path to vmx file     list running processes in guest os

killprocessinguest       path to vmx file     kill a process in guest os

process id

runscriptinguest         path to vmx file     run a script in guest os

interpreter path

script_text

deletefileinguest        path to vmx file     delete a file in guest os

file

createdirectoryinguest   path to vmx file     create a directory in guest os

directory path

deletedirectoryinguest   path to vmx file     delete a directory in guest os

directory path

listdirectoryinguest     path to vmx file     list a directory in guest os

directory path

copyfilefromhosttoguest  path to vmx file     copy a file from host os to guest os

path on host

path in guest

copyfilefromguesttohost  path to vmx file     copy a file from guest os to host os

path in guest

path on host

renamefileinguest        path to vmx file     rename a file in guest os

original name

new name

general commands         parameters           description

list                                          list all running vms

upgradevm                path to vmx file     upgrade vm file format, virtual hw

installtools             path to vmx file     install tools in guest os

3、示例

1)開啟虛擬機器

vmrun start "/opt/vm_os/rh_os_b/red hat enterprise linux 5 64-bit.vmx" nogui|gui

2)停止虛擬機器

vmrun stop "/opt/vm_os/rh_os_b/red hat enterprise linux 5 64-bit.vmx" nogui|gui

3)重啟虛擬機器

vmrun restart "/opt/vm_os/rh_os_b/red hat enterprise linux 5 64-bit.vmx" nogui|gui

4)列出正在執行的虛擬機器

vmrun list

type命令簡介

簡介type命令用來顯示指定命令的型別。乙個命令的型別可以是如下之一 type命令是linux系統的一種機制,知道了是那種型別,我們就可以針對性的獲取幫助。比如內建命令可以用help命令來獲取幫助,外部命令用man或者info來獲取幫助。type命令的基本使用方式就是直接跟上命令名字。type a可...

whois命令簡介

whois 命令簡介 一 概述 whois 是linux unix 環境下的命令,按字面意思就是問 他是誰 通過對網域名稱的檢索 可以反饋回網域名稱的註冊資訊 包括持有人 管理資料以及技術聯絡資料 也包括該網域名稱的網域名稱伺服器。但是在世界上有幾個主要的 whois 伺服器,它們是whois.ri...

dd命令簡介

1.dd命令簡介 功能 把指定的輸入檔案拷貝到指定的輸出檔案中,並且在拷貝過程中可以進行格式轉換。可以用該命令實現dos下的diskcopy命令的作用。先用dd命令把軟盤上的資料寫成硬碟的乙個寄存盤案,再把這個寄存盤案寫入第二張軟盤上,完成diskcopy的功能。需要注意的是,應該將硬碟上的寄存盤案...