1virt-cat(1)                 Virtualization Support                 virt-cat(1)
2
3
4

NAME

6       virt-cat - Display files in a virtual machine
7

SYNOPSIS

9        virt-cat [--options] -d domname file [file ...]
10
11        virt-cat [--options] -a disk.img [-a disk.img ...] file [file ...]
12
13       Old-style:
14
15        virt-cat domname file
16
17        virt-cat disk.img file
18

DESCRIPTION

20       "virt-cat" is a command line tool to display the contents of "file"
21       where "file" exists in the named virtual machine (or disk image).
22
23       Multiple filenames can be given, in which case they are concatenated
24       together.  Each filename must be a full path, starting at the root
25       directory (starting with '/').
26
27       "virt-cat" can be used to quickly view a file.  To edit a file, use
28       "virt-edit".  For more complex cases you should look at the
29       guestfish(1) tool (see "USING GUESTFISH" below).
30

EXAMPLES

32       Display /etc/fstab file from inside the libvirt VM called "mydomain":
33
34        virt-cat -d mydomain /etc/fstab
35
36       Find out what packages were recently installed:
37
38        virt-cat -d mydomain /var/log/yum.log | tail
39
40       Find out who is logged on inside a virtual machine:
41
42        virt-cat -d mydomain /var/run/utmp > /tmp/utmp
43        who /tmp/utmp
44
45       or who was logged on:
46
47        virt-cat -d mydomain /var/log/wtmp > /tmp/wtmp
48        last -f /tmp/wtmp
49

OPTIONS

51       --help
52           Display brief help.
53
54       -a file
55       --add file
56           Add file which should be a disk image from a virtual machine.  If
57           the virtual machine has multiple block devices, you must supply all
58           of them with separate -a options.
59
60           The format of the disk image is auto-detected.  To override this
61           and force a particular format use the --format=.. option.
62
63       -a URI
64       --add URI
65           Add a remote disk.  See "ADDING REMOTE STORAGE" in guestfish(1).
66
67       --blocksize=512
68       --blocksize=4096
69       --blocksize
70           This parameter sets the sector size of the disk image.  It affects
71           all explicitly added subsequent disks after this parameter.  Using
72           --blocksize with no argument switches the disk sector size to the
73           default value which is usually 512 bytes.  See also
74           "guestfs_add_drive_opts" in guestfs(3).
75
76       -c URI
77       --connect URI
78           If using libvirt, connect to the given URI.  If omitted, then we
79           connect to the default libvirt hypervisor.
80
81           If you specify guest block devices directly (-a), then libvirt is
82           not used at all.
83
84       -d guest
85       --domain guest
86           Add all the disks from the named libvirt guest.  Domain UUIDs can
87           be used instead of names.
88
89       --echo-keys
90           When prompting for keys and passphrases, virt-cat normally turns
91           echoing off so you cannot see what you are typing.  If you are not
92           worried about Tempest attacks and there is no one else in the room
93           you can specify this flag to see what you are typing.
94
95       --format=raw|qcow2|..
96       --format
97           The default for the -a option is to auto-detect the format of the
98           disk image.  Using this forces the disk format for -a options which
99           follow on the command line.  Using --format with no argument
100           switches back to auto-detection for subsequent -a options.
101
102           For example:
103
104            virt-cat --format=raw -a disk.img file
105
106           forces raw format (no auto-detection) for disk.img.
107
108            virt-cat --format=raw -a disk.img --format -a another.img file
109
110           forces raw format (no auto-detection) for disk.img and reverts to
111           auto-detection for another.img.
112
113           If you have untrusted raw-format guest disk images, you should use
114           this option to specify the disk format.  This avoids a possible
115           security problem with malicious guests (CVE-2010-3851).
116
117       --key SELECTOR
118           Specify a key for LUKS, to automatically open a LUKS device when
119           using the inspection.
120
121           --key NAME:key:KEY_STRING
122           --key UUID:key:KEY_STRING
123           --key all:key:KEY_STRING
124               "NAME" is the libguestfs device name (eg. "/dev/sda1").  "UUID"
125               is the device UUID.  "all" means try the key against any
126               encrypted device.
127
128               Use the specified "KEY_STRING" as passphrase.
129
130           --key NAME:file:FILENAME
131           --key UUID:file:FILENAME
132           --key all:file:FILENAME
133               Read the passphrase from FILENAME.
134
135           --key NAME:clevis
136           --key UUID:clevis
137           --key all:clevis
138               Attempt passphrase-less unlocking for the device with Clevis,
139               over the network.  Please refer to "ENCRYPTED DISKS" in
140               guestfs(3) for more information on network-bound disk
141               encryption (NBDE).
142
143               Note that if any such option is present on the command line,
144               QEMU user networking will be automatically enabled for the
145               libguestfs appliance.
146
147       --keys-from-stdin
148           Read key or passphrase parameters from stdin.  The default is to
149           try to read passphrases from the user by opening /dev/tty.
150
151           If there are multiple encrypted devices then you may need to supply
152           multiple keys on stdin, one per line.
153
154       -m dev[:mountpoint[:options[:fstype]]]
155       --mount dev[:mountpoint[:options[:fstype]]]
156           Mount the named partition or logical volume on the given
157           mountpoint.
158
159           If the mountpoint is omitted, it defaults to /.
160
161           Specifying any mountpoint disables the inspection of the guest and
162           the mount of its root and all of its mountpoints, so make sure to
163           mount all the mountpoints needed to work with the filenames given
164           as arguments.
165
166           If you don’t know what filesystems a disk image contains, you can
167           either run guestfish without this option, then list the partitions,
168           filesystems and LVs available (see "list-partitions", "list-
169           filesystems" and "lvs" commands), or you can use the
170           virt-filesystems(1) program.
171
172           The third (and rarely used) part of the mount parameter is the list
173           of mount options used to mount the underlying filesystem.  If this
174           is not given, then the mount options are either the empty string or
175           "ro" (the latter if the --ro flag is used).  By specifying the
176           mount options, you override this default choice.  Probably the only
177           time you would use this is to enable ACLs and/or extended
178           attributes if the filesystem can support them:
179
180            -m /dev/sda1:/:acl,user_xattr
181
182           Using this flag is equivalent to using the "mount-options" command.
183
184           The fourth part of the parameter is the filesystem driver to use,
185           such as "ext3" or "ntfs". This is rarely needed, but can be useful
186           if multiple drivers are valid for a filesystem (eg: "ext2" and
187           "ext3"), or if libguestfs misidentifies a filesystem.
188
189       -v
190       --verbose
191           Enable verbose messages for debugging.
192
193       -V
194       --version
195           Display version number and exit.
196
197       -x  Enable tracing of libguestfs API calls.
198

OLD-STYLE COMMAND LINE ARGUMENTS

200       Previous versions of virt-cat allowed you to write either:
201
202        virt-cat disk.img [disk.img ...] file
203
204       or
205
206        virt-cat guestname file
207
208       whereas in this version you should use -a or -d respectively to avoid
209       the confusing case where a disk image might have the same name as a
210       guest.
211
212       For compatibility the old style is still supported.
213

LOG FILES

215       To list out the log files from guests, see the related tool
216       virt-log(1).  It understands binary log formats such as the systemd
217       journal.
218
219       To follow (tail) text log files, use virt-tail(1).
220

WINDOWS PATHS

222       "virt-cat" has a limited ability to understand Windows drive letters
223       and paths (eg. E:\foo\bar.txt).
224
225       If and only if the guest is running Windows then:
226
227       •   Drive letter prefixes like "C:" are resolved against the Windows
228           Registry to the correct filesystem.
229
230       •   Any backslash ("\") characters in the path are replaced with
231           forward slashes so that libguestfs can process it.
232
233       •   The path is resolved case insensitively to locate the file that
234           should be displayed.
235
236       There are some known shortcomings:
237
238       •   Some NTFS symbolic links may not be followed correctly.
239
240       •   NTFS junction points that cross filesystems are not followed.
241

USING GUESTFISH

243       guestfish(1) is a more powerful, lower level tool which you can use
244       when "virt-cat" doesn't work.
245
246       Using "virt-cat" is approximately equivalent to doing:
247
248        guestfish --ro -i -d domname download file -
249
250       where "domname" is the name of the libvirt guest, and "file" is the
251       full path to the file.  Note the final "-" (meaning "output to
252       stdout").
253
254       The command above uses libguestfs’s guest inspection feature and so
255       does not work on guests that libguestfs cannot inspect, or on things
256       like arbitrary disk images that don't contain guests.  To display a
257       file from a disk image directly, use:
258
259        guestfish --ro -a disk.img -m /dev/sda1 download file -
260
261       where disk.img is the disk image, /dev/sda1 is the filesystem within
262       the disk image, and "file" is the full path to the file.
263

EXIT STATUS

265       This program returns 0 if successful, or non-zero if there was an
266       error.
267

SEE ALSO

269       guestfs(3), guestfish(1), virt-copy-out(1), virt-edit(1), virt-log(1),
270       virt-tail(1), virt-tar-out(1), http://libguestfs.org/.
271

AUTHOR

273       Richard W.M. Jones http://people.redhat.com/~rjones/
274
276       Copyright (C) 2010-2023 Red Hat Inc.
277

LICENSE

279       This program is free software; you can redistribute it and/or modify it
280       under the terms of the GNU General Public License as published by the
281       Free Software Foundation; either version 2 of the License, or (at your
282       option) any later version.
283
284       This program is distributed in the hope that it will be useful, but
285       WITHOUT ANY WARRANTY; without even the implied warranty of
286       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
287       General Public License for more details.
288
289       You should have received a copy of the GNU General Public License along
290       with this program; if not, write to the Free Software Foundation, Inc.,
291       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
292

BUGS

294       To get a list of bugs against libguestfs, use this link:
295       https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
296
297       To report a new bug against libguestfs, use this link:
298       https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
299
300       When reporting a bug, please supply:
301
302       •   The version of libguestfs.
303
304       •   Where you got libguestfs (eg. which Linux distro, compiled from
305           source, etc)
306
307       •   Describe the bug accurately and give a way to reproduce it.
308
309       •   Run libguestfs-test-tool(1) and paste the complete, unedited output
310           into the bug report.
311
312
313
314guestfs-tools-1.51.6              2023-12-09                       virt-cat(1)
Impressum