FAQ entry: The API has hundreds of methods, where do I start? A: Start with the API overview in the manual page.
$ guestfish -h
Command Description
help display a list of commands or help on a command
quit quit guestfish
alloc allocate an image
echo display a line of text
edit edit a file in the image
lcd local change directory
glob expand wildcards in command
more view a file in the pager
reopen close and reopen libguestfs handle
sparse allocate a sparse image file
time measure time taken to run command
add-cdrom add a CD-ROM disk image to examine
add-drive add an image to examine or modify
add-drive-ro add a drive in snapshot mode (read-only)
add-drive-ro-with-if add a drive read-only specifying the QEMU block emulation to use
add-drive-with-if add a drive specifying the QEMU block emulation to use
aug-close close the current Augeas handle
aug-defnode define an Augeas node
aug-defvar define an Augeas variable
aug-get look up the value of an Augeas path
aug-init create a new Augeas handle
aug-insert insert a sibling Augeas node
aug-load load files into the tree
aug-ls list Augeas nodes under augpath
aug-match return Augeas nodes which match augpath
aug-mv move Augeas node
aug-rm remove an Augeas path
aug-save write all pending Augeas changes to disk
aug-set set Augeas path to value
available test availability of some parts of the API
blockdev-flushbufs flush device buffers
blockdev-getbsz get blocksize of block device
blockdev-getro is block device set to read-only
blockdev-getsize64 get total size of device in bytes
blockdev-getss get sectorsize of block device
blockdev-getsz get total size of device in 512-byte sectors
blockdev-rereadpt reread partition table
blockdev-setbsz set blocksize of block device
blockdev-setro set block device to read-only
blockdev-setrw set block device to read-write
case-sensitive-path return true path on case-insensitive filesystem
cat list the contents of a file
checksum compute MD5, SHAx or CRC checksum of file
chmod change file mode
chown change file owner and group
command run a command from the guest filesystem
command-lines run a command, returning lines
config add qemu parameters
cp copy a file
cp-a copy a file or directory recursively
dd copy from source to destination using dd
debug debugging and internals
df report file system disk space usage
df-h report file system disk space usage (human readable)
dmesg return kernel messages
download download a file to the local machine
drop-caches drop kernel page cache, dentries and inodes
du estimate file space usage
e2fsck-f check an ext2/ext3 filesystem
echo-daemon echo arguments back to the client
egrep return lines matching a pattern
egrepi return lines matching a pattern
equal test if two files have equal contents
exists test if file or directory exists
fallocate preallocate a file in the guest filesystem
fgrep return lines matching a pattern
fgrepi return lines matching a pattern
file determine file type
filesize return the size of the file in bytes
fill fill a file with octets
find find all files and directories
find0 find all files and directories, returning NUL-separated list
fsck run the filesystem checker
get-append get the additional kernel options
get-autosync get autosync mode
get-direct get direct appliance mode flag
get-e2label get the ext2/3/4 filesystem label
get-e2uuid get the ext2/3/4 filesystem UUID
get-memsize get memory allocated to the qemu subprocess
get-path get the search path
get-pid get PID of qemu subprocess
get-qemu get the qemu binary
get-recovery-proc get recovery process enabled flag
get-selinux get SELinux enabled flag
get-state get the current state
get-trace get command trace enabled flag
get-verbose get verbose mode
getcon get SELinux security context
getxattrs list extended attributes of a file or directory
glob-expand expand a wildcard path
grep return lines matching a pattern
grepi return lines matching a pattern
grub-install install GRUB
head return first 10 lines of a file
head-n return first N lines of a file
hexdump dump a file in hexadecimal
initrd-cat list the contents of a single file in an initrd
initrd-list list files in an initrd
inotify-add-watch add an inotify watch
inotify-close close the inotify handle
inotify-files return list of watched files that had events
inotify-init create an inotify handle
inotify-read return list of inotify events
inotify-rm-watch remove an inotify watch
is-busy is busy processing a command
is-config is in configuration state
is-dir test if file exists
is-file test if file exists
is-launching is launching subprocess
is-ready is ready to accept commands
kill-subprocess kill the qemu subprocess
launch launch the qemu subprocess
lchown change file owner and group
lgetxattrs list extended attributes of a file or directory
list-devices list the block devices
list-partitions list the partitions
ll list the files in a directory (long format)
ln create a hard link
ln-f create a hard link
ln-s create a symbolic link
ln-sf create a symbolic link
lremovexattr remove extended attribute of a file or directory
ls list the files in a directory
lsetxattr set extended attribute of a file or directory
lstat get file information for a symbolic link
lstatlist lstat on multiple files
lvcreate create an LVM volume group
lvm-remove-all remove all LVM LVs, VGs and PVs
lvremove remove an LVM logical volume
lvrename rename an LVM logical volume
lvresize resize an LVM logical volume
lvs list the LVM logical volumes (LVs)
lvs-full list the LVM logical volumes (LVs)
lxattrlist lgetxattr on multiple files
mkdir create a directory
mkdir-mode create a directory with a particular mode
mkdir-p create a directory and parents
mkdtemp create a temporary directory
mke2fs-J make ext2/3/4 filesystem with external journal
mke2fs-JL make ext2/3/4 filesystem with external journal
mke2fs-JU make ext2/3/4 filesystem with external journal
mke2journal make ext2/3/4 external journal
mke2journal-L make ext2/3/4 external journal with label
mke2journal-U make ext2/3/4 external journal with UUID
mkfifo make FIFO (named pipe)
mkfs make a filesystem
mkfs-b make a filesystem with block size
mkmountpoint create a mountpoint
mknod make block, character or FIFO devices
mknod-b make block device node
mknod-c make char device node
mkswap create a swap partition
mkswap-L create a swap partition with a label
mkswap-U create a swap partition with an explicit UUID
mkswap-file create a swap file
modprobe load a kernel module
mount mount a guest disk at a position in the filesystem
mount-loop mount a file using the loop device
mount-options mount a guest disk with mount options
mount-ro mount a guest disk, read-only
mount-vfs mount a guest disk with mount options and vfstype
mountpoints show mountpoints
mounts show mounted filesystems
mv move a file
ntfs-3g-probe probe NTFS volume
part-add add a partition to the device
part-disk partition whole disk with a single primary partition
part-get-parttype get the partition table type
part-init create an empty partition table
part-list list partitions on a device
part-set-bootable make a partition bootable
part-set-name set partition name
ping-daemon ping the guest daemon
pread read part of a file
pvcreate create an LVM physical volume
pvremove remove an LVM physical volume
pvresize resize an LVM physical volume
pvs list the LVM physical volumes (PVs)
pvs-full list the LVM physical volumes (PVs)
read-file read a file
read-lines read file as lines
readdir read directories entries
readlink read the target of a symbolic link
readlinklist readlink on multiple files
realpath canonicalized absolute pathname
removexattr remove extended attribute of a file or directory
resize2fs resize an ext2/ext3 filesystem
rm remove a file
rm-rf remove a file or directory recursively
rmdir remove a directory
rmmountpoint remove a mountpoint
scrub-device scrub (securely wipe) a device
scrub-file scrub (securely wipe) a file
scrub-freespace scrub (securely wipe) free space
set-append add options to kernel command line
set-autosync set autosync mode
set-direct enable or disable direct appliance mode
set-e2label set the ext2/3/4 filesystem label
set-e2uuid set the ext2/3/4 filesystem UUID
set-memsize set memory allocated to the qemu subprocess
set-path set the search path
set-qemu set the qemu binary
set-recovery-proc enable or disable the recovery process
set-selinux set SELinux enabled or disabled at appliance boot
set-trace enable or disable command traces
set-verbose set verbose mode
setcon set SELinux security context
setxattr set extended attribute of a file or directory
sfdisk create partitions on a block device
sfdiskM create partitions on a block device
sfdisk-N modify a single partition on a block device
sfdisk-disk-geometry display the disk geometry from the partition table
sfdisk-kernel-geometry display the kernel geometry
sfdisk-l display the partition table
sh run a command via the shell
sh-lines run a command via the shell returning lines
sleep sleep for some seconds
stat get file information
statvfs get file system statistics
strings print the printable strings in a file
strings-e print the printable strings in a file
swapoff-device disable swap on device
swapoff-file disable swap on file
swapoff-label disable swap on labeled swap partition
swapoff-uuid disable swap on swap partition by UUID
swapon-device enable swap on device
swapon-file enable swap on file
swapon-label enable swap on labeled swap partition
swapon-uuid enable swap on swap partition by UUID
sync sync disks, writes are flushed through to the disk image
tail return last 10 lines of a file
tail-n return last N lines of a file
tar-in unpack tarfile to directory
tar-out pack directory into tarfile
tgz-in unpack compressed tarball to directory
tgz-out pack directory into compressed tarball
touch update file timestamps or create a new file
truncate truncate a file to zero size
truncate-size truncate a file to a particular size
tune2fs-l get ext2/ext3/ext4 superblock details
umask set file mode creation mask (umask)
umount unmount a filesystem
umount-all unmount all filesystems
upload upload a file from the local machine
utimens set timestamp of a file with nanosecond precision
version get the library version number
vfs-type get the Linux VFS type corresponding to a mounted device
vg-activate activate or deactivate some volume groups
vg-activate-all activate or deactivate all volume groups
vgcreate create an LVM volume group
vgremove remove an LVM volume group
vgrename rename an LVM volume group
vgs list the LVM volume groups (VGs)
vgs-full list the LVM volume groups (VGs)
wc-c count characters in a file
wc-l count lines in a file
wc-w count words in a file
write-file create a file
zegrep return lines matching a pattern
zegrepi return lines matching a pattern
zero write zeroes to the device
zerofree zero unused inodes and disk blocks on ext2/3 filesystem
zfgrep return lines matching a pattern
zfgrepi return lines matching a pattern
zfile determine file type inside a compressed file
zgrep return lines matching a pattern
zgrepi return lines matching a pattern
Use -h / help to show detailed help for a command.

Pingback: Implementing simple bash tab completion for guestfish « Richard WM Jones
Pingback: guestfish now supports 502 commands | Richard WM Jones