5 virt-cat - Display files in a virtual machine
9 virt-cat [--options] -d domname file [file ...]
11 virt-cat [--options] -a disk.img [-a disk.img ...] file [file ...]
17 virt-cat disk.img file
21 C<virt-cat> is a command line tool to display the contents of C<file>
22 where C<file> exists in the named virtual machine (or disk image).
24 Multiple filenames can be given, in which case they are concatenated
25 together. Each filename must be a full path, starting at the root
26 directory (starting with '/').
28 C<virt-cat> can be used to quickly view a file. To edit a file, use
29 C<virt-edit>. For more complex cases you should look at the
30 L<guestfish(1)> tool (see L</USING GUESTFISH> below).
34 Display C</etc/fstab> file from inside the libvirt VM called
37 virt-cat -d mydomain /etc/fstab
39 List syslog messages from a VM disk image file:
41 virt-cat -a disk.img /var/log/messages | tail
43 Find out what DHCP IP address a VM acquired:
45 virt-cat -d mydomain /var/log/messages | \
46 grep 'dhclient: bound to' | tail
48 Find out what packages were recently installed:
50 virt-cat -d mydomain /var/log/yum.log | tail
52 Find out who is logged on inside a virtual machine:
54 virt-cat -d mydomain /var/run/utmp > /tmp/utmp
59 virt-cat -d mydomain /var/log/wtmp > /tmp/wtmp
74 Add I<file> which should be a disk image from a virtual machine. If
75 the virtual machine has multiple block devices, you must supply all of
76 them with separate I<-a> options.
78 The format of the disk image is auto-detected. To override this and
79 force a particular format use the I<--format=..> option.
83 =item B<--connect> URI
85 If using libvirt, connect to the given I<URI>. If omitted, then we
86 connect to the default libvirt hypervisor.
88 If you specify guest block devices directly (I<-a>), then libvirt is
93 =item B<--domain> guest
95 Add all the disks from the named libvirt guest. Domain UUIDs can be
96 used instead of names.
100 When prompting for keys and passphrases, virt-cat normally turns
101 echoing off so you cannot see what you are typing. If you are not
102 worried about Tempest attacks and there is no one else in the room you
103 can specify this flag to see what you are typing.
105 =item B<--format=raw|qcow2|..>
109 The default for the I<-a> option is to auto-detect the format of the
110 disk image. Using this forces the disk format for I<-a> options which
111 follow on the command line. Using I<--format> with no argument
112 switches back to auto-detection for subsequent I<-a> options.
116 virt-cat --format=raw -a disk.img file
118 forces raw format (no auto-detection) for C<disk.img>.
120 virt-cat --format=raw -a disk.img --format -a another.img file
122 forces raw format (no auto-detection) for C<disk.img> and reverts to
123 auto-detection for C<another.img>.
125 If you have untrusted raw-format guest disk images, you should use
126 this option to specify the disk format. This avoids a possible
127 security problem with malicious guests (CVE-2010-3851).
129 =item B<--keys-from-stdin>
131 Read key or passphrase parameters from stdin. The default is
132 to try to read passphrases from the user by opening C</dev/tty>.
138 Enable verbose messages for debugging.
144 Display version number and exit.
148 Enable tracing of libguestfs API calls.
152 =head1 OLD-STYLE COMMAND LINE ARGUMENTS
154 Previous versions of virt-cat allowed you to write either:
156 virt-cat disk.img [disk.img ...] file
160 virt-cat guestname file
162 whereas in this version you should use I<-a> or I<-d> respectively
163 to avoid the confusing case where a disk image might have the same
166 For compatibility the old style is still supported.
170 C<virt-cat> has a limited ability to understand Windows drive letters
171 and paths (eg. C<E:\foo\bar.txt>).
173 If and only if the guest is running Windows then:
179 Drive letter prefixes like C<C:> are resolved against the
180 Windows Registry to the correct filesystem.
184 Any backslash (C<\>) characters in the path are replaced
185 with forward slashes so that libguestfs can process it.
189 The path is resolved case insensitively to locate the file
190 that should be displayed.
194 There are some known shortcomings:
200 Some NTFS symbolic links may not be followed correctly.
204 NTFS junction points that cross filesystems are not followed.
208 =head1 USING GUESTFISH
210 L<guestfish(1)> is a more powerful, lower level tool which you can use
211 when C<virt-cat> doesn't work.
213 Using C<virt-cat> is approximately equivalent to doing:
215 guestfish --ro -i -d domname download file -
217 where C<domname> is the name of the libvirt guest, and C<file> is the
218 full path to the file. Note the final C<-> (meaning "output to
221 The command above uses libguestfs's guest inspection feature and so
222 does not work on guests that libguestfs cannot inspect, or on things
223 like arbitrary disk images that don't contain guests. To display a
224 file from a disk image directly, use:
226 guestfish --ro -a disk.img -m /dev/sda1 download file -
228 where C<disk.img> is the disk image, C</dev/sda1> is the filesystem
229 within the disk image, and C<file> is the full path to the file.
233 Libvirt guest names can contain arbitrary characters, some of which
234 have meaning to the shell such as C<#> and space. You may need to
235 quote or escape these characters on the command line. See the shell
236 manual page L<sh(1)> for details.
240 This program returns 0 if successful, or non-zero if there was an
250 L<http://libguestfs.org/>.
254 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
258 Copyright (C) 2010-2011 Red Hat Inc.
260 This program is free software; you can redistribute it and/or modify
261 it under the terms of the GNU General Public License as published by
262 the Free Software Foundation; either version 2 of the License, or
263 (at your option) any later version.
265 This program is distributed in the hope that it will be useful,
266 but WITHOUT ANY WARRANTY; without even the implied warranty of
267 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
268 GNU General Public License for more details.
270 You should have received a copy of the GNU General Public License
271 along with this program; if not, write to the Free Software
272 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.