1virt-cat(1) Virtualization Support virt-cat(1)
2
3
4
6 virt-cat - Display files in a virtual machine
7
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
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
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
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 -c URI
68 --connect URI
69 If using libvirt, connect to the given URI. If omitted, then we
70 connect to the default libvirt hypervisor.
71
72 If you specify guest block devices directly (-a), then libvirt is
73 not used at all.
74
75 -d guest
76 --domain guest
77 Add all the disks from the named libvirt guest. Domain UUIDs can
78 be used instead of names.
79
80 --echo-keys
81 When prompting for keys and passphrases, virt-cat normally turns
82 echoing off so you cannot see what you are typing. If you are not
83 worried about Tempest attacks and there is no one else in the room
84 you can specify this flag to see what you are typing.
85
86 --format=raw|qcow2|..
87 --format
88 The default for the -a option is to auto-detect the format of the
89 disk image. Using this forces the disk format for -a options which
90 follow on the command line. Using --format with no argument
91 switches back to auto-detection for subsequent -a options.
92
93 For example:
94
95 virt-cat --format=raw -a disk.img file
96
97 forces raw format (no auto-detection) for disk.img.
98
99 virt-cat --format=raw -a disk.img --format -a another.img file
100
101 forces raw format (no auto-detection) for disk.img and reverts to
102 auto-detection for another.img.
103
104 If you have untrusted raw-format guest disk images, you should use
105 this option to specify the disk format. This avoids a possible
106 security problem with malicious guests (CVE-2010-3851).
107
108 --key SELECTOR
109 Specify a key for LUKS, to automatically open a LUKS device when
110 using the inspection. "SELECTOR" can be in one of the following
111 formats:
112
113 --key "DEVICE":key:KEY_STRING
114 Use the specified "KEY_STRING" as passphrase.
115
116 --key "DEVICE":file:FILENAME
117 Read the passphrase from FILENAME.
118
119 --keys-from-stdin
120 Read key or passphrase parameters from stdin. The default is to
121 try to read passphrases from the user by opening /dev/tty.
122
123 -m dev[:mountpoint[:options[:fstype]]]
124 --mount dev[:mountpoint[:options[:fstype]]]
125 Mount the named partition or logical volume on the given
126 mountpoint.
127
128 If the mountpoint is omitted, it defaults to /.
129
130 Specifying any mountpoint disables the inspection of the guest and
131 the mount of its root and all of its mountpoints, so make sure to
132 mount all the mountpoints needed to work with the filenames given
133 as arguments.
134
135 If you don’t know what filesystems a disk image contains, you can
136 either run guestfish without this option, then list the partitions,
137 filesystems and LVs available (see "list-partitions", "list-
138 filesystems" and "lvs" commands), or you can use the
139 virt-filesystems(1) program.
140
141 The third (and rarely used) part of the mount parameter is the list
142 of mount options used to mount the underlying filesystem. If this
143 is not given, then the mount options are either the empty string or
144 "ro" (the latter if the --ro flag is used). By specifying the
145 mount options, you override this default choice. Probably the only
146 time you would use this is to enable ACLs and/or extended
147 attributes if the filesystem can support them:
148
149 -m /dev/sda1:/:acl,user_xattr
150
151 Using this flag is equivalent to using the "mount-options" command.
152
153 The fourth part of the parameter is the filesystem driver to use,
154 such as "ext3" or "ntfs". This is rarely needed, but can be useful
155 if multiple drivers are valid for a filesystem (eg: "ext2" and
156 "ext3"), or if libguestfs misidentifies a filesystem.
157
158 -v
159 --verbose
160 Enable verbose messages for debugging.
161
162 -V
163 --version
164 Display version number and exit.
165
166 -x Enable tracing of libguestfs API calls.
167
169 Previous versions of virt-cat allowed you to write either:
170
171 virt-cat disk.img [disk.img ...] file
172
173 or
174
175 virt-cat guestname file
176
177 whereas in this version you should use -a or -d respectively to avoid
178 the confusing case where a disk image might have the same name as a
179 guest.
180
181 For compatibility the old style is still supported.
182
184 To list out the log files from guests, see the related tool
185 virt-log(1). It understands binary log formats such as the systemd
186 journal.
187
188 To follow (tail) text log files, use virt-tail(1).
189
191 "virt-cat" has a limited ability to understand Windows drive letters
192 and paths (eg. E:\foo\bar.txt).
193
194 If and only if the guest is running Windows then:
195
196 · Drive letter prefixes like "C:" are resolved against the Windows
197 Registry to the correct filesystem.
198
199 · Any backslash ("\") characters in the path are replaced with
200 forward slashes so that libguestfs can process it.
201
202 · The path is resolved case insensitively to locate the file that
203 should be displayed.
204
205 There are some known shortcomings:
206
207 · Some NTFS symbolic links may not be followed correctly.
208
209 · NTFS junction points that cross filesystems are not followed.
210
212 guestfish(1) is a more powerful, lower level tool which you can use
213 when "virt-cat" doesn't work.
214
215 Using "virt-cat" is approximately equivalent to doing:
216
217 guestfish --ro -i -d domname download file -
218
219 where "domname" is the name of the libvirt guest, and "file" is the
220 full path to the file. Note the final "-" (meaning "output to
221 stdout").
222
223 The command above uses libguestfs’s guest inspection feature and so
224 does not work on guests that libguestfs cannot inspect, or on things
225 like arbitrary disk images that don't contain guests. To display a
226 file from a disk image directly, use:
227
228 guestfish --ro -a disk.img -m /dev/sda1 download file -
229
230 where disk.img is the disk image, /dev/sda1 is the filesystem within
231 the disk image, and "file" is the full path to the file.
232
234 This program returns 0 if successful, or non-zero if there was an
235 error.
236
238 guestfs(3), guestfish(1), virt-copy-out(1), virt-edit(1), virt-log(1),
239 virt-tail(1), virt-tar-out(1), http://libguestfs.org/.
240
242 Richard W.M. Jones http://people.redhat.com/~rjones/
243
245 Copyright (C) 2010-2012 Red Hat Inc.
246
248 This program is free software; you can redistribute it and/or modify it
249 under the terms of the GNU General Public License as published by the
250 Free Software Foundation; either version 2 of the License, or (at your
251 option) any later version.
252
253 This program is distributed in the hope that it will be useful, but
254 WITHOUT ANY WARRANTY; without even the implied warranty of
255 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
256 General Public License for more details.
257
258 You should have received a copy of the GNU General Public License along
259 with this program; if not, write to the Free Software Foundation, Inc.,
260 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
261
263 To get a list of bugs against libguestfs, use this link:
264 https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
265
266 To report a new bug against libguestfs, use this link:
267 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
268
269 When reporting a bug, please supply:
270
271 · The version of libguestfs.
272
273 · Where you got libguestfs (eg. which Linux distro, compiled from
274 source, etc)
275
276 · Describe the bug accurately and give a way to reproduce it.
277
278 · Run libguestfs-test-tool(1) and paste the complete, unedited output
279 into the bug report.
280
281
282
283libguestfs-1.40.2 2019-02-07 virt-cat(1)