5 virt-ls - List files in a virtual machine
9 virt-ls [--options] -d domname directory [directory ...]
11 virt-ls [--options] -a disk.img [-a disk.img ...] directory [directory ...]
15 virt-ls [--options] domname directory
17 virt-ls [--options] disk.img [disk.img ...] directory
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.
24 Multiple directory names can be given, in which case the output
25 from each is concatenated.
27 C<virt-ls> is just a simple wrapper around L<libguestfs(3)>
28 functionality. For more complex cases you should look at the
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>
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:
38 $ virt-ls -d myguest /
43 With the I<-l> (I<--long>) option, C<virt-ls> shows more detail:
45 $ virt-ls -l -d myguest /
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
51 With the I<-R> (I<--recursive>) option, C<virt-ls> lists the
52 names of files and directories recursively:
54 $ virt-ls -R -d myguest /tmp
59 You I<cannot> combine these options. To do more complicated things,
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.
78 The format of the disk image is auto-detected. To override this and
79 force a particular format use the I<--format=..> option.
83 =item B<--connect> URI
85 If using libvirt, connect to the given I<URI>. If omitted, then we
86 connect to the default libvirt hypervisor.
88 If you specify guest block devices directly (I<-a>), then libvirt is
93 =item B<--domain> guest
95 Add all the disks from the named libvirt guest.
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.
104 =item B<--format=raw|qcow2|..>
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.
115 virt-ls --format=raw -a disk.img /dir
117 forces raw format (no auto-detection) for C<disk.img>.
119 virt-ls --format=raw -a disk.img --format -a another.img /dir
121 forces raw format (no auto-detection) for C<disk.img> and reverts to
122 auto-detection for C<another.img>.
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).
128 =item B<--keys-from-stdin>
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>.
133 =item B<-l> | B<--long>
135 =item B<-R> | B<--recursive>
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.
140 C<virt-ls -l> produces a "long listing", which shows more detail (just
141 like the plain C<ls -l> command).
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>
147 You cannot combine these options.
153 Enable verbose messages for debugging.
159 Display version number and exit.
163 Enable tracing of libguestfs API calls.
167 =head1 OLD-STYLE COMMAND LINE ARGUMENTS
169 Previous versions of virt-ls allowed you to write either:
171 virt-ls disk.img [disk.img ...] /dir
175 virt-ls guestname /dir
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
181 For compatibility the old style is still supported.
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.
197 L<Sys::Guestfs::Lib(3)>,
199 L<http://libguestfs.org/>.
203 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
207 Copyright (C) 2009 Red Hat Inc.
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.
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.
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.