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 C<-l> (C<--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 C<-R> (C<--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). See also
129 =item B<--keys-from-stdin>
131 Read key or passphrase parameters from stdin. The default is
132 to try to read passphrases from the user by opening C</dev/tty>.
134 =item B<-l> | B<--long>
136 =item B<-R> | B<--recursive>
138 Select the mode. With neither of these options, C<virt-ls>
139 produces a simple, flat list of the files in the named directory.
141 C<virt-ls -l> produces a "long listing", which shows more detail (just
142 like the plain C<ls -l> command).
144 C<virt-ls -R> produces a recursive list of files starting at the named
145 directory. See the documentation for L<guestfs(3)/guestfs_find0>
148 You cannot combine these options.
154 Enable verbose messages for debugging.
160 Display version number and exit.
164 Enable tracing of libguestfs API calls.
168 =head1 OLD-STYLE COMMAND LINE ARGUMENTS
170 Previous versions of virt-ls allowed you to write either:
172 virt-ls disk.img [disk.img ...] /dir
176 virt-ls guestname /dir
178 whereas in this version you should use I<-a> or I<-d> respectively
179 to avoid the confusing case where a disk image might have the same
182 For compatibility the old style is still supported.
186 Libvirt guest names can contain arbitrary characters, some of which
187 have meaning to the shell such as C<#> and space. You may need to
188 quote or escape these characters on the command line. See the shell
189 manual page L<sh(1)> for details.
198 L<Sys::Guestfs::Lib(3)>,
200 L<http://libguestfs.org/>.
204 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
208 Copyright (C) 2009 Red Hat Inc.
210 This program is free software; you can redistribute it and/or modify
211 it under the terms of the GNU General Public License as published by
212 the Free Software Foundation; either version 2 of the License, or
213 (at your option) any later version.
215 This program is distributed in the hope that it will be useful,
216 but WITHOUT ANY WARRANTY; without even the implied warranty of
217 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
218 GNU General Public License for more details.
220 You should have received a copy of the GNU General Public License
221 along with this program; if not, write to the Free Software
222 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.