Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands tagged virtualbox from sorted by
Terminal - Commands tagged virtualbox - 20 results
sudo dmidecode | grep Product
2012-12-18 12:31:39
User: joaquindlz
Functions: grep sudo
1

Command used to know if we are working on a virtual or physical machine. This command will use the dmidecode utility to retrieve hardware information of your computer via the BIOS. Run this command as root or with sudo.

sudo usermod -a -G vboxusers <username>
VBoxManage modifyvm "vm-name" --vrdp on --vrdpport 3389 --vrdpauthtype external
2012-02-03 18:36:04
User: 0disse0
-1

--vrdp on enables VirtualBox RDP server for the VM

--vrdpport 3389 ndicates the TCP port that the server will accept RDP connections direct to the VM (for each VM is assigned a different port)

--vrdpauthtype external RDP console gives access to the VM Host physical users via authentication

In fact, in the 3.1.x version of VirtualBox, the external value for the parameter --vrdpauthtype allows access via RDP only to the user who started the VM.

The workaround is to add the user that runs the VM to shadow group, using the command

VBoxManage closemedium dvd "/sicuramente/mipaghi/tutto.iso
VBoxManage storageattach "volpedimongibello" --storagectl "fighetto" --port 1 --device 0 --type dvddrive --medium "/tanto/mipaghi/tutto.iso
2012-01-31 14:42:54
User: 0disse0
-1

was inspired by http://www.commandlinefu.com/commands/view/8936/boot-from-a-block-device-without-giving-root-privilege-to-virtual-box

volpedimongibello= virtual machine name

fighetto= controller name

tutto.iso= DVD iso image

How to remove the DVD:

VBoxManage storageattach "volpedimongibello" --storagectl "fighetto" --port 1 --device 0 --type dvddrive --medium none

VBoxManage internalcommands createrawvmdk -filename [path/to/file/name.vmdk] -rawdisk /dev/[block_device]
2011-08-19 14:26:22
User: totti
0

eg:

VBoxManage internalcommands createrawvmdk -filename ~/.VBox_sdc.vmdk -rawdisk /dev/sdc

In order to start virtual box using block devices, ( Or to boot from it) run as ROOT

sudo VirtualBox

Then add & select the vmdk file as a device.

At last Start the virtual box.

- This cmd needs to run once for a device.

- See command 8936 to run with out using ROOT power and easy handling of Virtual m/c

VBoxBlockBoot() { sudo umount "$2"*; sudo chmod 777 "$2"; VBoxManage storageattach "$1" --medium ~/.rawHD4VB_`basename "$2"`.vmdk --type hdd --storagectl "IDE Controller" --device 0 --port 0 ; VBoxManage startvm "$1";}
2011-07-29 13:04:19
User: totti
Functions: chmod sudo umount
0

Usage: VBoxBlockBoot [Virtual_Machine] [Block_device]

Eg: VBoxBlockBoot WinXP /dev/sdc

In another words

vm=usb; usb=sdc;sudo umount /dev/$usb* ; sudo chmod 777 /dev/$usb ; VBoxManage storageattach $vm --medium ~/raw-HD-4-VB/$usb.vmdk --type hdd --storagectl "IDE Controller" --device 0 --port 0 ; VBoxManage startvm $vm

Where

vm --> Name of the virtual machine to start

usb --> Block device to use. (/dev/sdc)

This can used after setup up a boot loader on to my USB pen drive or HDD (After creating Live USB). Here root privilege is needed but not granted to Virtual Box. Thus we can access all our VM.( If we run VBox as root we can't access our VMs). Root privilege is used to

- Unmount the storage device

- Chmod to full access (777)

Requirements:-

1. Device information file (rawvmdk file) created by the following command. Need to run only once. Not bad to run many.

VBoxCreateRawDisk() { VBoxManage internalcommands createrawvmdk -filename ~/.rawHD4VB_`basename "$1"`.vmdk -rawdisk "$1"; }

2. Root privilege to umount & chmod

3. Real storage medium (ie /dev/*) (Non-virtual such as USB HD, pen drive, a partition)

4. A virtual m/c already available (here "usb")

vm=usb; usb=sdc;sudo umount /dev/$usb* ; sudo chmod 777 /dev/$usb ; VBoxManage storageattach $vm --medium ~/raw-HD-4-VB/$usb.vmdk --type hdd --storagectl "IDE Controller" --device 0 --port 0 ; VBoxManage startvm $vm

VBoxBlockBoot() { sudo umount "$2"*; sudo chmod 777 "$2"; VBoxManage storageattach "$1" --medium ~/.rawHD4VB_`basename "$2"`.vmdk --type hdd --storagectl "IDE Controller" --device 0 --port 0 ; VBoxManage startvm "$1"; }

VBoxManage modifyvm "vm-name" --memory 256 --acpi on --ioapic off --pae on --hwvirtex on --nestedpaging on
2011-06-16 18:14:47
User: 0disse0
1

where

- memory 256 assign 256 Mb RAM

- acpi on enable ACPI (mandatory if you use Winfog 2000

- ioapic off disable the IO APIC. Not useful if you use one CPU (on virtual machine or a 32 bit operative system). As ACPI, this switch is mandatory for Winbug 2000

- pae on enable the Phisical Address Extension how to use more than 4Gb of RAM on x86 CPU

- hwvirtex on enables hardware virtualization extensions for microprocessors that have this feature (which should be also enabled in the BIOS of the motherboard)

- nestedpaging on allows part of the processes of memory management hardware are made directly

vboxmanage clonehd --format VMDK <source image|uuid> <destination image>
2010-10-04 16:42:12
User: dreffed
-3

This is based on the Windows Version of VirtualBox.

From the /? ...

VBoxManage clonehd |

[--format VDI|VMDK|VHD|RAW|]

[--variant Standard,Fixed,Split2G,Stream,ESX]

[--type normal|writethrough|immutable|shareable]

[--remember] [--existing]

From the online help..

http://www.virtualbox.org/manual/ch08.html#id2676537

VBoxManage clonehd

This command duplicates a registered virtual hard disk image to a new image file with a new unique identifier (UUID). The new image can be transferred to another host system or imported into VirtualBox again using the Virtual Media Manager; see the section called ?The Virtual Media Manager? and the section called ?Cloning disk images?. The syntax is as follows:

VBoxManage clonehd |

[--format VDI|VMDK|VHD|RAW|]

[--variant Standard,Fixed,Split2G,Stream,ESX]

[--type normal|writethrough|immutable]

[--remember]

where the parameters mean:

format

Allow to choose a file format for the output file different from the file format of the input file.

variant

Allow to choose a file format variant for the output file. It is a comma-separated list of variant flags. Not all combinations are supported, and specifying inconsistent flags will result in an error message.

type

Only honored if --remember is also specified. Defines what kind of hard disk type this image should be.

remember

Keep the destination image registered after it was successfully written.

VBoxManage openmedium dvd "/path/name.iso"
2010-04-23 06:56:42
User: 0disse0
0

No comment... it's easy! Using the VBoxManage list and the switch 'hdds' or 'dvds' you can show the list of hard disks and DVD registered on the system.

VBoxManage createvm --name "vm-name" --ostype Ubuntu --register
VBoxManage list ostypes
2010-04-23 06:50:42
User: 0disse0
-1

If you want to know what OS are supported on "guest" machines on the Sun VirtualBox server.

VBoxManage showvminfo "cicciobox" --details
2010-04-23 06:45:29
User: 0disse0
Tags: virtualbox
-1

where "cicciobox" is the name of your virtual machine in a Sun VirtualBox server

VBoxManage list systemproperties
2010-04-23 06:43:49
User: 0disse0
Tags: virtualbox
-1

How to show the system properties of a Sun VirtualBox server

VBoxManage controlvm ServidorProducao savestate
nohup VBoxHeadless -p 3052 -startvm ServidorProducao &
VBoxManage internalcommands converttoraw winxp.vdi winxp.raw && qemu-img convert -O vmdk winxp.raw winxp.vmdk && rm winxp.raw
2009-10-12 16:23:37
Functions: rm
9

Converts a .vdi file to a .vmdk file for use in a vmware virtual machine. The benefit: using this method actually works. There are others out there that claim to give you a working .vmdk by simply using the qemu-img command alone. Doing that only results in pain for you because the .vmdk file will be created with no errors, but it won't boot either.

Be advised that these conversions are very disk-intensive by nature; you are probably dealing with disk images several gigabytes in size.

Once finished, the process of using the new .vmdk file is left as an exercise to the reader.

VBoxManage list vms
2009-08-07 12:43:04
2

A similar command that lists only the currently running VMs is thus:

VBoxManage list runningvms

...the above showing a list of VMs by name and UUID in the same format as the "$ VBoxManage list vms" command

VBoxHeadless -s <name|uuid>
2009-08-07 12:36:32
5

you can launch a VirtualBox VM from the command line using VBoxManage, but that invokes it in a gui environment.

If you want to just fire off your VM in the background, use VBoxHeadless as shown. To get the names and UUIDs of your VirtualBox VMs, type:

VBoxManage list
VBoxManage startvm "name"