virt-edit is a command line tool to edit file where each file exists in the named virtual machine (or disk image).

Multiple filenames can be given, in which case they are each edited in turn. Each filename must be a full path, starting at the root directory (starting with ‘/’).

If you want to just view a file, use virt-cat(1).

For more complex cases you should look at the guestfish(1) tool (see “USING GUESTFISH” below).

virt-edit cannot be used to create a new file. guestfish(1) can do that and much more.


Using virt-edit on live virtual machines, or concurrently with other disk editing tools, can be dangerous, potentially causing disk corruption. The virtual machine must be shut down before you use this command, and disk images must not be edited concurrently.


Edit the named files interactively:

 virt-edit -d mydomain /boot/grub/grub.conf

 virt-edit -d mydomain /etc/passwd

For Windows guests, some Windows paths are understood:

 virt-edit -d mywindomain 'c:\autoexec.bat'

If Perl is installed, you can also edit files non-interactively (see “NON-INTERACTIVE EDITING” below). To change the init default level to 5:

 virt-edit -d mydomain /etc/inittab -e 's/^id:.*/id:5:initdefault:/'

virt-edit – Edit a file in a KVM virtual machine
Getagd op:

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *