Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

16.4.2. 使用 guestfish 修改文件

要修改文件,请创建目录或对客户机虚拟机进行其他更改,首先在本节的开头显示警告: 您的 guest 虚拟机必须关闭。使用 guestfish 编辑或更改正在运行的磁盘 将导致 磁盘损坏。这部分提供了编辑 /boot/grub/grub.conf 文件的示例。确定 guest 虚拟机已关闭时,您可以省略 --ro 选项以便通过命令获得写入访问权限,例如:
guestfish -d RHEL3 -i

Welcome to guestfish, the libguestfs filesystem interactive shell for
 editing virtual machine filesystems.

 Type: 'help' for help on commands
       'man' to read the manual
       'quit' to quit the shell

 Operating system: Red Hat Enterprise Linux AS release 3 (Taroon Update 9)
 /dev/vda2 mounted on /
 /dev/vda1 mounted on /boot

><fs> edit /boot/grub/grub.conf
编辑文件的命令包括 编辑vi s 和 emacs。还存在用于创建文件和目录的许多命令,如 writemkdiruploadtar-in