docs: Remove ref to L</add-drive-opts> wrongly copied into some man pages.
[libguestfs.git] / cat / virt-ls.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 virt-ls - List files in a virtual machine
6
7 =head1 SYNOPSIS
8
9  virt-ls [--options] -d domname directory [directory ...]
10
11  virt-ls [--options] -a disk.img [-a disk.img ...] directory [directory ...]
12
13 Old style:
14
15  virt-ls [--options] domname directory
16
17  virt-ls [--options] disk.img [disk.img ...] directory
18
19 =head1 DESCRIPTION
20
21 C<virt-ls> is a command line tool to list the names of files in a
22 directory inside a virtual machine or disk image.
23
24 Multiple directory names can be given, in which case the output
25 from each is concatenated.
26
27 C<virt-ls> is just a simple wrapper around L<libguestfs(3)>
28 functionality.  For more complex cases you should look at the
29 L<guestfish(1)> tool.
30
31 To list directories from a libvirt guest use the I<-d> option to
32 specify the name of the guest.  For a disk image, use the I<-a>
33 option.
34
35 C<virt-ls> can be used in one of three modes: simple, long and
36 recursive.  A simple listing is like the ordinary L<ls(1)> command:
37
38  $ virt-ls -d myguest /
39  bin
40  boot
41  [etc.]
42
43 With the C<-l> (C<--long>) option, C<virt-ls> shows more detail:
44
45  $ virt-ls -l -d myguest /
46  total 204
47  dr-xr-xr-x.   2 root root   4096 2009-08-25 19:06 bin
48  dr-xr-xr-x.   5 root root   3072 2009-08-25 19:06 boot
49  [etc.]
50
51 With the C<-R> (C<--recursive>) option, C<virt-ls> lists the
52 names of files and directories recursively:
53
54  $ virt-ls -R -d myguest /tmp
55  foo
56  foo/bar
57  [etc.]
58
59 You I<cannot> combine these options.  To do more complicated things,
60 use L<guestfish(1)>.
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-ls 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|..>
105
106 =item B<--format>
107
108 The default for the I<-a> option is to auto-detect the format of the
109 disk image.  Using this forces the disk format for I<-a> options which
110 follow on the command line.  Using I<--format> with no argument
111 switches back to auto-detection for subsequent I<-a> options.
112
113 For example:
114
115  virt-ls --format=raw -a disk.img /dir
116
117 forces raw format (no auto-detection) for C<disk.img>.
118
119  virt-ls --format=raw -a disk.img --format -a another.img /dir
120
121 forces raw format (no auto-detection) for C<disk.img> and reverts to
122 auto-detection for C<another.img>.
123
124 If you have untrusted raw-format guest disk images, you should use
125 this option to specify the disk format.  This avoids a possible
126 security problem with malicious guests (CVE-2010-3851).
127
128 =item B<--keys-from-stdin>
129
130 Read key or passphrase parameters from stdin.  The default is
131 to try to read passphrases from the user by opening C</dev/tty>.
132
133 =item B<-l> | B<--long>
134
135 =item B<-R> | B<--recursive>
136
137 Select the mode.  With neither of these options, C<virt-ls>
138 produces a simple, flat list of the files in the named directory.
139
140 C<virt-ls -l> produces a "long listing", which shows more detail (just
141 like the plain C<ls -l> command).
142
143 C<virt-ls -R> produces a recursive list of files starting at the named
144 directory.  See the documentation for L<guestfs(3)/guestfs_find0>
145 for precise details.
146
147 You cannot combine these options.
148
149 =item B<-v>
150
151 =item B<--verbose>
152
153 Enable verbose messages for debugging.
154
155 =item B<-V>
156
157 =item B<--version>
158
159 Display version number and exit.
160
161 =item B<-x>
162
163 Enable tracing of libguestfs API calls.
164
165 =back
166
167 =head1 OLD-STYLE COMMAND LINE ARGUMENTS
168
169 Previous versions of virt-ls allowed you to write either:
170
171  virt-ls disk.img [disk.img ...] /dir
172
173 or
174
175  virt-ls guestname /dir
176
177 whereas in this version you should use I<-a> or I<-d> respectively
178 to avoid the confusing case where a disk image might have the same
179 name as a guest.
180
181 For compatibility the old style is still supported.
182
183 =head1 SHELL QUOTING
184
185 Libvirt guest names can contain arbitrary characters, some of which
186 have meaning to the shell such as C<#> and space.  You may need to
187 quote or escape these characters on the command line.  See the shell
188 manual page L<sh(1)> for details.
189
190 =head1 SEE ALSO
191
192 L<guestfs(3)>,
193 L<guestfish(1)>,
194 L<virt-cat(1)>,
195 L<virt-tar(1)>,
196 L<Sys::Guestfs(3)>,
197 L<Sys::Guestfs::Lib(3)>,
198 L<Sys::Virt(3)>,
199 L<http://libguestfs.org/>.
200
201 =head1 AUTHOR
202
203 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
204
205 =head1 COPYRIGHT
206
207 Copyright (C) 2009 Red Hat Inc.
208
209 This program is free software; you can redistribute it and/or modify
210 it under the terms of the GNU General Public License as published by
211 the Free Software Foundation; either version 2 of the License, or
212 (at your option) any later version.
213
214 This program is distributed in the hope that it will be useful,
215 but WITHOUT ANY WARRANTY; without even the implied warranty of
216 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
217 GNU General Public License for more details.
218
219 You should have received a copy of the GNU General Public License
220 along with this program; if not, write to the Free Software
221 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.