virt-cat(1)
π virt-cat β Display files in a virtual machine β¨
okay so you're looking at the virt-cat(1) page bestie, and honestly? it's a whole vibe. it's a little command-line tool that justβ¦ shows you files from inside a virtual machine or disk image. no editing, no drama, just reading. let's get into it π«Ά
πΈ NAME πΈ
virt-cat β display files in a virtual machine. that's it. that's the job. and it slays at it π
β¨ SYNOPSIS β¨
virt-cat [--options] -d domname file [file ...]
virt-cat [--options] -a disk.img [-a disk.img ...] file [file ...]
and the old-style way (iykyk):
virt-cat domname file
virt-cat disk.img file
π¦ DESCRIPTION π¦
so virt-cat is a command line tool that displays the contents of file β as long as file actually exists inside the named virtual machine (or disk image, no cap).
you can hand it multiple filenames and it'll just concatenate them all together, one after another. every filename has to be a full path starting at the root directory (so it starts with /, not vibes).
virt-cat is the move when you wanna quickly view a file. if you wanna edit one, that's virt-edit's whole thing. and for the more complex situations? go look at the guestfish(1) tool (peep "USING GUESTFISH" below π).
π EXAMPLES π
display the /etc/fstab file from inside the libvirt VM called mydomain:
virt-cat -d mydomain /etc/fstab
find out what packages were recently installed (the | tail is doing so much work here):
virt-cat -d mydomain /var/log/yum.log | tail
find out who is logged on inside a virtual machine:
virt-cat -d mydomain /var/run/utmp > /tmp/utmp
who /tmp/utmp
or who was logged on:
virt-cat -d mydomain /var/log/wtmp > /tmp/wtmp
last -f /tmp/wtmp
π OPTIONS π
--helpβ display brief help. short, sweet, helpful. queen behavior.-a file,--add fileβ addfile, which should be a disk image from a virtual machine. if your VM has multiple block devices you must supply all of them with separate-aoptions. (all of them. don't skip any. the girlies who skip get errors.)
the format of the disk image is auto-detected. wanna override that and force a particular format? use the --format=.. option.
-a URI,--add URIβ add a remote disk. see "ADDING REMOTE STORAGE" in guestfish(1) π«--blocksize=512,--blocksize=4096,--blocksizeβ this parameter sets the sector size of the disk image. it affects all explicitly added subsequent disks after this parameter. using--blocksizewith no argument switches the disk sector size to the default value, which is usually512bytes. see also "guestfs_add_drive_opts" in guestfs(3).-c URI,--connect URIβ if you're using libvirt, connect to the given URI. if you omit it, we connect to the default libvirt hypervisor.
if you specify guest block devices directly (-a), then libvirt isn't used at all. not even a little bit. it's not invited to the party.
-d guest,--domain guestβ add all the disks from the named libvirt guest. domain UUIDs can be used instead of names, iconic of them honestly.--echo-keysβ when prompting for keys and passphrases, virt-cat normally turns echoing off so you can't see what you're typing. if you're not worried about Tempest attacks and there's literally no one else in the room, you can specify this flag to see what you're typing. (only under those conditions bestie, I'm serious π)--format=raw|qcow2|..,--formatβ the default for the-aoption is to auto-detect the format of the disk image. using this forces the disk format for-aoptions which follow on the command line. using--formatwith no argument switches back to auto-detection for subsequent-aoptions.
for example:
virt-cat --format=raw -a disk.img file
forces raw format (no auto-detection) for disk.img.
virt-cat --format=raw -a disk.img --format -a another.img file
forces raw format (no auto-detection) for disk.img and reverts to auto-detection for another.img.
π¨ if you have untrusted raw-format guest disk images, you should use this option to specify the disk format. this avoids a possible security problem with malicious guests (CVE-2010-3851). like, please. don't skip this one.
--key SELECTORβ specify a key for LUKS, to automatically open a LUKS device when using the inspection.--key NAME:key:KEY_STRING,--key UUID:key:KEY_STRING,--key all:key:KEY_STRINGβNAMEis the libguestfs device name (eg./dev/sda1).UUIDis the device UUID.allmeans try the key against any encrypted device.
use the specified KEY_STRING as passphrase.
--key NAME:file:FILENAME,--key UUID:file:FILENAME,--key all:file:FILENAMEβ read the passphrase from FILENAME.--key NAME:clevis,--key UUID:clevis,--key all:clevisβ attempt passphrase-less unlocking for the device with Clevis, over the network. please refer to "ENCRYPTED DISKS" in guestfs(3) for more information on network-bound disk encryption (NBDE).
note that if any such option is present on the command line, QEMU user networking will be automatically enabled for the libguestfs appliance.
--key NAME:error,--key UUID:error,--key all:errorβ any encrypted device matching will cause an error.--key all:errorcan be used to reject any disk image that contains an encrypted partition. very "we don't serve your kind here" of it.
--keys-from-stdinβ read key or passphrase parameters from stdin. the default is to try to read passphrases from the user by opening/dev/tty.
if there are multiple encrypted devices then you may need to supply multiple keys on stdin, one per line. one. per. line. π
-m dev[:mountpoint[:options[:fstype]]],--mount dev[:mountpoint[:options[:fstype]]]β mount the named partition or logical volume on the given mountpoint.
if the mountpoint is omitted, it defaults to /.
specifying any mountpoint disables the inspection of the guest and the mount of its root and all of its mountpoints β so make sure to mount all the mountpoints needed to work with the filenames given as arguments. no pressure or anything.
if you don't know what filesystems a disk image contains, you can either run guestfish without this option, then list the partitions, filesystems and LVs available (see list-partitions, list-filesystems and lvs commands), or you can use the virt-filesystems(1) program. both valid, both cute.
the third (and rarely used) part of the mount parameter is the list of mount options used to mount the underlying filesystem. if this isn't given, then the mount options are either the empty string or ro (the latter if the --ro flag is used). by specifying the mount options, you override this default choice. probably the only time you'd use this is to enable ACLs and/or extended attributes if the filesystem can support them:
-m /dev/sda1:/:acl,user_xattr
using this flag is equivalent to using the mount-options command.
the fourth part of the parameter is the filesystem driver to use, such as ext3 or ntfs. this is rarely needed, but can be useful if multiple drivers are valid for a filesystem (eg: ext2 and ext3), or if libguestfs misidentifies a filesystem. it happens. we forgive.
-v,--verboseβ enable verbose messages for debugging. the girlies love a paper trail.-V,--versionβ display version number and exit. bye bestie π-xβ enable tracing of libguestfs API calls. watch it work. observe the mechanics. very mesmerizing.
π OLD-STYLE COMMAND LINE ARGUMENTS π
previous versions of virt-cat let you write either:
virt-cat disk.img [disk.img ...] file
or
virt-cat guestname file
but in this version you should use -a or -d respectively β to avoid that super confusing case where a disk image might have the exact same name as a guest. awkward. we don't do that anymore.
for compatibility the old style is still supported. it's grandfathered in, like a legacy tweet.
π§ LOG FILES π§
want to list out the log files from guests? check out the related tool virt-log(1). it understands binary log formats such as the systemd journal β fancy.
want to follow (tail) text log files? use virt-tail(1). that's literally its whole personality.
π WINDOWS PATHS π
virt-cat has a limited ability to understand Windows drive letters and paths (eg. E:\foo\bar.txt). limited. don't push it.
if and only if the guest is running Windows, then:
- drive letter prefixes like
C:are resolved against the Windows Registry to the correct filesystem. - any backslash (
\) characters in the path are replaced with forward slashes so that libguestfs can process it. - the path is resolved case insensitively to locate the file that should be displayed.
there are some known shortcomings (not flaws, shortcomings, ok):
- some NTFS symbolic links may not be followed correctly.
- NTFS junction points that cross filesystems are not followed.
π yeah, those are real. sorry. we said "limited" and we meant it.
π₯ USING GUESTFISH π₯
guestfish(1) is a more powerful, lower level tool which you can use when virt-cat doesn't work. think of it as the big sister with more options.
using virt-cat is approximately equivalent to doing:
guestfish --ro -i -d domname download file -
where domname is the name of the libvirt guest, and file is the full path to the file. note the final - (meaning "output to stdout"). it's load-bearing. don't remove it.
the command above uses libguestfs's guest inspection feature and so does not work on guests that libguestfs cannot inspect, or on things like arbitrary disk images that don't contain guests. to display a file from a disk image directly, use:
guestfish --ro -a disk.img -m /dev/sda1 download file -
where disk.img is the disk image, /dev/sda1 is the filesystem within the disk image, and file is the full path to the file. see? told you. π
β EXIT STATUS β
this program returns 0 if successful, or non-zero if there was an error. that's the whole exit status section. short king.
π SEE ALSO π
guestfs(3), guestfish(1), virt-copy-out(1), virt-edit(1), virt-log(1), virt-tail(1), virt-tar-out(1), http://libguestfs.org/.
the whole squad, honestly π
π AUTHOR π
Richard W.M. Jones http://people.redhat.com/~rjones/
πΈ COPYRIGHT πΈ
Copyright (C) 2010-2025 Red Hat Inc.
π LICENSE π
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
π BUGS π
to get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
to report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
when reporting a bug, please supply:
- the version of libguestfs.
- where you got libguestfs (eg. which Linux distro, compiled from source, etc)
- describe the bug accurately and give a way to reproduce it.
- run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report. complete. unedited. we mean it π«Ά
okay that's the whole page!! this little beauty is from guestfs-tools-1.57.3, dated 2026-09-16, and it's the virt-cat(1) manual β go read some files bestie, you've got this πβ¨
π¦ where this page comes from
- centos-stream 10: guestfs-tools 1.57.3-1.el10 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms