inspect: Abstract the wrapper that sets up Augeas.
[libguestfs.git] / cat / virt-cat.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 virt-cat - Display files in a virtual machine
6
7 =head1 SYNOPSIS
8
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
19 =head1 DESCRIPTION
20
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).
23
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 '/').
27
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.
31
32 =head1 EXAMPLES
33
34 Display C</etc/fstab> file from inside the libvirt VM called
35 C<mydomain>:
36
37  virt-cat -d mydomain /etc/fstab
38
39 List syslog messages from a VM disk image file:
40
41  virt-cat -a disk.img /var/log/messages | tail
42
43 Find out what DHCP IP address a VM acquired:
44
45  virt-cat -d mydomain /var/log/messages | \
46    grep 'dhclient: bound to' | tail
47
48 Find out what packages were recently installed:
49
50  virt-cat -d mydomain /var/log/yum.log | tail
51
52 Find out who is logged on inside a virtual machine:
53
54  virt-cat -d mydomain /var/run/utmp > /tmp/utmp
55  who /tmp/utmp
56
57 or who was logged on:
58
59  virt-cat -d mydomain /var/log/wtmp > /tmp/wtmp
60  last -f /tmp/wtmp
61
62 =head1 OPTIONS
63
64 =over 4
65
66 =item B<--help>
67
68 Display brief help.
69
70 =item B<-a> file
71
72 =item B<--add> file
73
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.
77
78 The format of the disk image is auto-detected.  To override this and
79 force a particular format use the I<--format=..> option.
80
81 =item B<-c> URI
82
83 =item B<--connect> URI
84
85 If using libvirt, connect to the given I<URI>.  If omitted, then we
86 connect to the default libvirt hypervisor.
87
88 If you specify guest block devices directly (I<-a>), then libvirt is
89 not used at all.
90
91 =item B<-d> guest
92
93 =item B<--domain> guest
94
95 Add all the disks from the named libvirt guest.
96
97 =item B<--echo-keys>
98
99 When prompting for keys and passphrases, virt-cat normally turns
100 echoing off so you cannot see what you are typing.  If you are not
101 worried about Tempest attacks and there is no one else in the room you
102 can specify this flag to see what you are typing.
103
104 =item B<--format=raw|qcow2|..> | B<--format>
105
106 The default for the I<-a> option is to auto-detect the format of the
107 disk image.  Using this forces the disk format for I<-a> options which
108 follow on the command line.  Using I<--format> with no argument
109 switches back to auto-detection for subsequent I<-a> options.
110
111 For example:
112
113  virt-cat --format=raw -a disk.img
114
115 forces raw format (no auto-detection) for C<disk.img>.
116
117  virt-cat --format=raw -a disk.img --format -a another.img
118
119 forces raw format (no auto-detection) for C<disk.img> and reverts to
120 auto-detection for C<another.img>.
121
122 If you have untrusted raw-format guest disk images, you should use
123 this option to specify the disk format.  This avoids a possible
124 security problem with malicious guests (CVE-2010-3851).  See also
125 L</add-drive-opts>.
126
127 =item B<--keys-from-stdin>
128
129 Read key or passphrase parameters from stdin.  The default is
130 to try to read passphrases from the user by opening C</dev/tty>.
131
132 =item B<-v>
133
134 =item B<--verbose>
135
136 Enable verbose messages for debugging.
137
138 =item B<-V>
139
140 =item B<--version>
141
142 Display version number and exit.
143
144 =item B<-x>
145
146 Enable tracing of libguestfs API calls.
147
148 =back
149
150 =head1 OLD-STYLE COMMAND LINE ARGUMENTS
151
152 Previous versions of virt-cat allowed you to write either:
153
154  virt-cat disk.img [disk.img ...] file
155
156 or
157
158  virt-cat guestname file
159
160 whereas in this version you should use I<-a> or I<-d> respectively
161 to avoid the confusing case where a disk image might have the same
162 name as a guest.
163
164 For compatibility the old style is still supported.
165
166 =head1 SHELL QUOTING
167
168 Libvirt guest names can contain arbitrary characters, some of which
169 have meaning to the shell such as C<#> and space.  You may need to
170 quote or escape these characters on the command line.  See the shell
171 manual page L<sh(1)> for details.
172
173 =head1 SEE ALSO
174
175 L<guestfs(3)>,
176 L<guestfish(1)>,
177 L<virt-edit(1)>,
178 L<http://libguestfs.org/>.
179
180 =head1 AUTHOR
181
182 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
183
184 =head1 COPYRIGHT
185
186 Copyright (C) 2010 Red Hat Inc.
187
188 This program is free software; you can redistribute it and/or modify
189 it under the terms of the GNU General Public License as published by
190 the Free Software Foundation; either version 2 of the License, or
191 (at your option) any later version.
192
193 This program is distributed in the hope that it will be useful,
194 but WITHOUT ANY WARRANTY; without even the implied warranty of
195 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
196 GNU General Public License for more details.
197
198 You should have received a copy of the GNU General Public License
199 along with this program; if not, write to the Free Software
200 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.