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 List syslog messages from a VM disk image file:
37
38 virt-cat -a disk.img /var/log/messages | tail
39
40 Find out what DHCP IP address a VM acquired:
41
42 virt-cat -d mydomain /var/log/messages | \
43 grep 'dhclient: bound to' | tail
44
45 Find out what packages were recently installed:
46
47 virt-cat -d mydomain /var/log/yum.log | tail
48
49 Find out who is logged on inside a virtual machine:
50
51 virt-cat -d mydomain /var/run/utmp > /tmp/utmp
52 who /tmp/utmp
53
54 or who was logged on:
55
56 virt-cat -d mydomain /var/log/wtmp > /tmp/wtmp
57 last -f /tmp/wtmp
58
60 --help
61 Display brief help.
62
63 -a file
64 --add file
65 Add file which should be a disk image from a virtual machine. If
66 the virtual machine has multiple block devices, you must supply all
67 of them with separate -a options.
68
69 The format of the disk image is auto-detected. To override this
70 and force a particular format use the --format=.. option.
71
72 -c URI
73 --connect URI
74 If using libvirt, connect to the given URI. If omitted, then we
75 connect to the default libvirt hypervisor.
76
77 If you specify guest block devices directly (-a), then libvirt is
78 not used at all.
79
80 -d guest
81 --domain guest
82 Add all the disks from the named libvirt guest. Domain UUIDs can
83 be used instead of names.
84
85 --echo-keys
86 When prompting for keys and passphrases, virt-cat normally turns
87 echoing off so you cannot see what you are typing. If you are not
88 worried about Tempest attacks and there is no one else in the room
89 you can specify this flag to see what you are typing.
90
91 --format=raw|qcow2|..
92 --format
93 The default for the -a option is to auto-detect the format of the
94 disk image. Using this forces the disk format for -a options which
95 follow on the command line. Using --format with no argument
96 switches back to auto-detection for subsequent -a options.
97
98 For example:
99
100 virt-cat --format=raw -a disk.img file
101
102 forces raw format (no auto-detection) for "disk.img".
103
104 virt-cat --format=raw -a disk.img --format -a another.img file
105
106 forces raw format (no auto-detection) for "disk.img" and reverts to
107 auto-detection for "another.img".
108
109 If you have untrusted raw-format guest disk images, you should use
110 this option to specify the disk format. This avoids a possible
111 security problem with malicious guests (CVE-2010-3851).
112
113 --keys-from-stdin
114 Read key or passphrase parameters from stdin. The default is to
115 try to read passphrases from the user by opening "/dev/tty".
116
117 -v
118 --verbose
119 Enable verbose messages for debugging.
120
121 -V
122 --version
123 Display version number and exit.
124
125 -x Enable tracing of libguestfs API calls.
126
128 Previous versions of virt-cat allowed you to write either:
129
130 virt-cat disk.img [disk.img ...] file
131
132 or
133
134 virt-cat guestname file
135
136 whereas in this version you should use -a or -d respectively to avoid
137 the confusing case where a disk image might have the same name as a
138 guest.
139
140 For compatibility the old style is still supported.
141
143 "virt-cat" has a limited ability to understand Windows drive letters
144 and paths (eg. "E:\foo\bar.txt").
145
146 If and only if the guest is running Windows then:
147
148 · Drive letter prefixes like "C:" are resolved against the Windows
149 Registry to the correct filesystem.
150
151 · Any backslash ("\") characters in the path are replaced with
152 forward slashes so that libguestfs can process it.
153
154 · The path is resolved case insensitively to locate the file that
155 should be displayed.
156
157 There are some known shortcomings:
158
159 · Some NTFS symbolic links may not be followed correctly.
160
161 · NTFS junction points that cross filesystems are not followed.
162
164 guestfish(1) is a more powerful, lower level tool which you can use
165 when "virt-cat" doesn't work.
166
167 Using "virt-cat" is approximately equivalent to doing:
168
169 guestfish --ro -i -d domname download file -
170
171 where "domname" is the name of the libvirt guest, and "file" is the
172 full path to the file. Note the final "-" (meaning "output to
173 stdout").
174
175 The command above uses libguestfs's guest inspection feature and so
176 does not work on guests that libguestfs cannot inspect, or on things
177 like arbitrary disk images that don't contain guests. To display a
178 file from a disk image directly, use:
179
180 guestfish --ro -a disk.img -m /dev/sda1 download file -
181
182 where "disk.img" is the disk image, "/dev/sda1" is the filesystem
183 within the disk image, and "file" is the full path to the file.
184
186 Libvirt guest names can contain arbitrary characters, some of which
187 have meaning to the shell such as "#" and space. You may need to quote
188 or escape these characters on the command line. See the shell manual
189 page sh(1) for details.
190
192 This program returns 0 if successful, or non-zero if there was an
193 error.
194
196 guestfs(3), guestfish(1), virt-copy-out(1), virt-edit(1),
197 virt-tar-out(1), http://libguestfs.org/.
198
200 Richard W.M. Jones http://people.redhat.com/~rjones/
201
203 Copyright (C) 2010-2012 Red Hat Inc.
204
206 This program is free software; you can redistribute it and/or modify it
207 under the terms of the GNU General Public License as published by the
208 Free Software Foundation; either version 2 of the License, or (at your
209 option) any later version.
210
211 This program is distributed in the hope that it will be useful, but
212 WITHOUT ANY WARRANTY; without even the implied warranty of
213 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
214 General Public License for more details.
215
216 You should have received a copy of the GNU General Public License along
217 with this program; if not, write to the Free Software Foundation, Inc.,
218 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
219
221 To get a list of bugs against libguestfs, use this link:
222 https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
223
224 To report a new bug against libguestfs, use this link:
225 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
226
227 When reporting a bug, please supply:
228
229 · The version of libguestfs.
230
231 · Where you got libguestfs (eg. which Linux distro, compiled from
232 source, etc)
233
234 · Describe the bug accurately and give a way to reproduce it.
235
236 · Run libguestfs-test-tool(1) and paste the complete, unedited output
237 into the bug report.
238
239
240
241libguestfs-1.20.11 2013-08-27 virt-cat(1)