generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).
[libguestfs.git] / fish / guestfish.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 guestfish - the libguestfs Filesystem Interactive SHell
6
7 =head1 SYNOPSIS
8
9  guestfish [--options] [commands]
10
11  guestfish
12
13  guestfish -a disk.img
14
15  guestfish -a disk.img -m dev[:mountpoint]
16
17  guestfish -d libvirt-domain
18
19  guestfish -a disk.img -i
20
21  guestfish -d libvirt-domain -i
22
23 =head1 WARNING
24
25 Using guestfish in read/write mode on live virtual machines can be
26 dangerous, potentially causing disk corruption.  Use the I<--ro>
27 (read-only) option to use guestfish safely if the disk image or
28 virtual machine might be live.
29
30 =head1 DESCRIPTION
31
32 Guestfish is a shell and command-line tool for examining and modifying
33 virtual machine filesystems.  It uses libguestfs and exposes all of
34 the functionality of the guestfs API, see L<guestfs(3)>.
35
36 Guestfish gives you structured access to the libguestfs API, from
37 shell scripts or the command line or interactively.  If you want to
38 rescue a broken virtual machine image, you should look at the
39 L<virt-rescue(1)> command.
40
41 =head1 EXAMPLES
42
43 =head2 As an interactive shell
44
45  $ guestfish
46  
47  Welcome to guestfish, the libguestfs filesystem interactive shell for
48  editing virtual machine filesystems.
49  
50  Type: 'help' for a list of commands
51        'man' to read the manual
52        'quit' to quit the shell
53  
54  ><fs> add-ro disk.img
55  ><fs> run
56  ><fs> list-filesystems
57  /dev/sda1: ext4
58  /dev/vg_guest/lv_root: ext4
59  /dev/vg_guest/lv_swap: swap
60  ><fs> mount /dev/vg_guest/lv_root /
61  ><fs> cat /etc/fstab
62  # /etc/fstab
63  # Created by anaconda
64  [...]
65  ><fs> exit
66
67 =head2 From shell scripts
68
69 Create a new C</etc/motd> file in a guest or disk image:
70
71  guestfish <<_EOF_
72  add disk.img
73  run
74  mount /dev/vg_guest/lv_root /
75  write /etc/motd "Welcome, new users"
76  _EOF_
77
78 List the LVM logical volumes in a disk image:
79
80  guestfish -a disk.img --ro <<_EOF_
81  run
82  lvs
83  _EOF_
84
85 List all the filesystems in a disk image:
86
87  guestfish -a disk.img --ro <<_EOF_
88  run
89  list-filesystems
90  _EOF_
91
92 =head2 On one command line
93
94 Update C</etc/resolv.conf> in a guest:
95
96  guestfish \
97    add disk.img : run : mount /dev/vg_guest/lv_root / : \
98    write /etc/resolv.conf "nameserver 1.2.3.4"
99
100 Edit C</boot/grub/grub.conf> interactively:
101
102  guestfish --add disk.img \
103    --mount /dev/vg_guest/lv_root \
104    --mount /dev/sda1:/boot \
105    edit /boot/grub/grub.conf
106
107 =head2 Mount disks automatically
108
109 Use the I<-i> option to automatically mount the
110 disks from a virtual machine:
111
112  guestfish --ro -a disk.img -i cat /etc/group
113
114  guestfish --ro -d libvirt-domain -i cat /etc/group
115
116 Another way to edit C</boot/grub/grub.conf> interactively is:
117
118  guestfish -a disk.img -i edit /boot/grub/grub.conf
119
120 =head2 As a script interpreter
121
122 Create a 100MB disk containing an ext2-formatted partition:
123
124  #!/usr/bin/guestfish -f
125  sparse test1.img 100M
126  run
127  part-disk /dev/sda mbr
128  mkfs ext2 /dev/sda1
129
130 =head2 Start with a prepared disk
131
132 An alternate way to create a 100MB disk called C<test1.img> containing
133 a single ext2-formatted partition:
134
135  guestfish -N fs
136
137 To list what is available do:
138
139  guestfish -N help | less
140
141 =head2 Remote control
142
143  eval `guestfish --listen`
144  guestfish --remote add-ro disk.img
145  guestfish --remote run
146  guestfish --remote lvs
147
148 =head1 OPTIONS
149
150 =over 4
151
152 =item B<--help>
153
154 Displays general help on options.
155
156 =item B<-h> | B<--cmd-help>
157
158 Lists all available guestfish commands.
159
160 =item B<-h cmd> | B<--cmd-help cmd>
161
162 Displays detailed help on a single command C<cmd>.
163
164 =item B<-a image> | B<--add image>
165
166 Add a block device or virtual machine image to the shell.
167
168 =item B<-c URI> | B<--connect URI>
169
170 When used in conjunction with the I<-d> option, this specifies
171 the libvirt URI to use.  The default is to use the default libvirt
172 connection.
173
174 =item B<-d libvirt-domain> | B<--domain libvirt-domain>
175
176 Add disks from the named libvirt domain.  If the I<--ro> option is
177 also used, then any libvirt domain can be used.  However in write
178 mode, only libvirt domains which are shut down can be named here.
179
180 =item B<-D> | B<--no-dest-paths>
181
182 Don't tab-complete paths on the guest filesystem.  It is useful to be
183 able to hit the tab key to complete paths on the guest filesystem, but
184 this causes extra "hidden" guestfs calls to be made, so this option is
185 here to allow this feature to be disabled.
186
187 =item B<--echo-keys>
188
189 When prompting for keys and passphrases, guestfish normally turns
190 echoing off so you cannot see what you are typing.  If you are not
191 worried about Tempest attacks and there is no one else in the room
192 you can specify this flag to see what you are typing.
193
194 =item B<-f file> | B<--file file>
195
196 Read commands from C<file>.  To write pure guestfish
197 scripts, use:
198
199  #!/usr/bin/guestfish -f
200
201 =item B<-i> | B<--inspector>
202
203 Using L<virt-inspector(1)> code, inspect the disks looking for
204 an operating system and mount filesystems as they would be
205 mounted on the real virtual machine.
206
207 Typical usage is either:
208
209  guestfish -d myguest -i
210
211 (for an inactive libvirt domain called I<myguest>), or:
212
213  guestfish --ro -d myguest -i
214
215 (for active domains, readonly), or specify the block device directly:
216
217  guestfish -a /dev/Guests/MyGuest -i
218
219 Note that the command line syntax changed slightly over older
220 versions of guestfish.  You can still use the old syntax:
221
222  guestfish [--ro] -i disk.img
223
224  guestfish [--ro] -i libvirt-domain
225
226 =item B<--keys-from-stdin>
227
228 Read key or passphrase parameters from stdin.  The default is
229 to try to read passphrases from the user by opening C</dev/tty>.
230
231 =item B<--listen>
232
233 Fork into the background and listen for remote commands.  See section
234 L</REMOTE CONTROL GUESTFISH OVER A SOCKET> below.
235
236 =item B<-m dev[:mountpoint]> | B<--mount dev[:mountpoint]>
237
238 Mount the named partition or logical volume on the given mountpoint.
239
240 If the mountpoint is omitted, it defaults to C</>.
241
242 You have to mount something on C</> before most commands will work.
243
244 If any I<-m> or I<--mount> options are given, the guest is
245 automatically launched.
246
247 If you don't know what filesystems a disk image contains, you
248 can either run guestfish without this option, then list the partitions
249 and LVs available (see L</list-partitions> and L</lvs> commands),
250 or you can use the L<virt-list-filesystems(1)> program.
251
252 =item B<-n> | B<--no-sync>
253
254 Disable autosync.  This is enabled by default.  See the discussion
255 of autosync in the L<guestfs(3)> manpage.
256
257 =item B<-N type> | B<--new type> | B<-N help>
258
259 Prepare a fresh disk image formatted as "type".  This is an
260 alternative to the I<-a> option: whereas I<-a> adds an existing disk,
261 I<-N> creates a preformatted disk with a filesystem and adds it.
262 See L</PREPARED DISK IMAGES> below.
263
264 =item B<--progress-bars>
265
266 Enable progress bars, even when guestfish is used non-interactively.
267
268 Progress bars are enabled by default when guestfish is used as an
269 interactive shell.
270
271 =item B<--no-progress-bars>
272
273 Disable progress bars.
274
275 =item B<--remote[=pid]>
276
277 Send remote commands to C<$GUESTFISH_PID> or C<pid>.  See section
278 L</REMOTE CONTROL GUESTFISH OVER A SOCKET> below.
279
280 =item B<-r> | B<--ro>
281
282 This changes the I<-a> and I<-m> options so that disks are added and
283 mounts are done read-only (see L<guestfs(3)/guestfs_mount_ro>).
284
285 The option must always be used if the disk image or virtual machine
286 might be running, and is generally recommended in cases where you
287 don't need write access to the disk.
288
289 Note that prepared disk images created with I<-N> are not affected by
290 the I<--ro> option.
291
292 =item B<--selinux>
293
294 Enable SELinux support for the guest.  See L<guestfs(3)/SELINUX>.
295
296 =item B<-v> | B<--verbose>
297
298 Enable very verbose messages.  This is particularly useful if you find
299 a bug.
300
301 =item B<-V> | B<--version>
302
303 Display the guestfish / libguestfs version number and exit.
304
305 =item B<-x>
306
307 Echo each command before executing it.
308
309 =back
310
311 =head1 COMMANDS ON COMMAND LINE
312
313 Any additional (non-option) arguments are treated as commands to
314 execute.
315
316 Commands to execute should be separated by a colon (C<:>), where the
317 colon is a separate parameter.  Thus:
318
319  guestfish cmd [args...] : cmd [args...] : cmd [args...] ...
320
321 If there are no additional arguments, then we enter a shell, either an
322 interactive shell with a prompt (if the input is a terminal) or a
323 non-interactive shell.
324
325 In either command line mode or non-interactive shell, the first
326 command that gives an error causes the whole shell to exit.  In
327 interactive mode (with a prompt) if a command fails, you can continue
328 to enter commands.
329
330 =head1 USING launch (OR run)
331
332 As with L<guestfs(3)>, you must first configure your guest by adding
333 disks, then launch it, then mount any disks you need, and finally
334 issue actions/commands.  So the general order of the day is:
335
336 =over 4
337
338 =item *
339
340 add or -a/--add
341
342 =item *
343
344 launch (aka run)
345
346 =item *
347
348 mount or -m/--mount
349
350 =item *
351
352 any other commands
353
354 =back
355
356 C<run> is a synonym for C<launch>.  You must C<launch> (or C<run>)
357 your guest before mounting or performing any other commands.
358
359 The only exception is that if any of the I<-i>, I<-m>, I<--mount>,
360 I<-N> or I<--new> options were given then C<run> is done
361 automatically, simply because guestfish can't perform the action you
362 asked for without doing this.
363
364 =head1 QUOTING
365
366 You can quote ordinary parameters using either single or double
367 quotes.  For example:
368
369  add "file with a space.img"
370
371  rm '/file name'
372
373  rm '/"'
374
375 A few commands require a list of strings to be passed.  For these, use
376 a whitespace-separated list, enclosed in quotes.  Strings containing whitespace
377 to be passed through must be enclosed in single quotes.  A literal single quote
378 must be escaped with a backslash.
379
380  vgcreate VG "/dev/sda1 /dev/sdb1"
381  command "/bin/echo 'foo      bar'"
382  command "/bin/echo \'foo\'"
383
384 =head1 OPTIONAL ARGUMENTS
385
386 Some commands take optional arguments.  These arguments appear in this
387 documentation as C<[argname:..]>.  You can use them as in these
388 examples:
389
390  add-drive-opts filename
391
392  add-drive-opts filename readonly:true
393
394  add-drive-opts filename format:qcow2 readonly:false
395
396 Each optional argument can appear at most once.  All optional
397 arguments must appear after the required ones.
398
399 =head1 NUMBERS
400
401 This section applies to all commands which can take integers
402 as parameters.
403
404 =head2 SIZE SUFFIX
405
406 When the command takes a parameter measured in bytes, you can use one
407 of the following suffixes to specify kilobytes, megabytes and larger
408 sizes:
409
410 =over 4
411
412 =item B<k> or B<K> or B<KiB>
413
414 The size in kilobytes (multiplied by 1024).
415
416 =item B<KB>
417
418 The size in SI 1000 byte units.
419
420 =item B<M> or B<MiB>
421
422 The size in megabytes (multiplied by 1048576).
423
424 =item B<MB>
425
426 The size in SI 1000000 byte units.
427
428 =item B<G> or B<GiB>
429
430 The size in gigabytes (multiplied by 2**30).
431
432 =item B<GB>
433
434 The size in SI 10**9 byte units.
435
436 =item B<T> or B<TiB>
437
438 The size in terabytes (multiplied by 2**40).
439
440 =item B<TB>
441
442 The size in SI 10**12 byte units.
443
444 =item B<P> or B<PiB>
445
446 The size in petabytes (multiplied by 2**50).
447
448 =item B<PB>
449
450 The size in SI 10**15 byte units.
451
452 =item B<E> or B<EiB>
453
454 The size in exabytes (multiplied by 2**60).
455
456 =item B<EB>
457
458 The size in SI 10**18 byte units.
459
460 =item B<Z> or B<ZiB>
461
462 The size in zettabytes (multiplied by 2**70).
463
464 =item B<ZB>
465
466 The size in SI 10**21 byte units.
467
468 =item B<Y> or B<YiB>
469
470 The size in yottabytes (multiplied by 2**80).
471
472 =item B<YB>
473
474 The size in SI 10**24 byte units.
475
476 =back
477
478 For example:
479
480  truncate-size /file 1G
481
482 would truncate the file to 1 gigabyte.
483
484 Be careful because a few commands take sizes in kilobytes or megabytes
485 (eg. the parameter to L</memsize> is specified in megabytes already).
486 Adding a suffix will probably not do what you expect.
487
488 =head2 OCTAL AND HEXADECIMAL NUMBERS
489
490 For specifying the radix (base) use the C convention: C<0> to prefix
491 an octal number or C<0x> to prefix a hexadecimal number.  For example:
492
493  1234      decimal number 1234
494  02322     octal number, equivalent to decimal 1234
495  0x4d2     hexadecimal number, equivalent to decimal 1234
496
497 When using the C<chmod> command, you almost always want to specify an
498 octal number for the mode, and you must prefix it with C<0> (unlike
499 the Unix L<chmod(1)> program):
500
501  chmod 0777 /public  # OK
502  chmod 777 /public   # WRONG! This is mode 777 decimal = 01411 octal.
503
504 Commands that return numbers usually print them in decimal, but
505 some commands print numbers in other radices (eg. C<umask> prints
506 the mode in octal, preceeded by C<0>).
507
508 =head1 WILDCARDS AND GLOBBING
509
510 Neither guestfish nor the underlying guestfs API performs
511 wildcard expansion (globbing) by default.  So for example the
512 following will not do what you expect:
513
514  rm-rf /home/*
515
516 Assuming you don't have a directory called literally C</home/*>
517 then the above command will return an error.
518
519 To perform wildcard expansion, use the C<glob> command.
520
521  glob rm-rf /home/*
522
523 runs C<rm-rf> on each path that matches (ie. potentially running
524 the command many times), equivalent to:
525
526  rm-rf /home/jim
527  rm-rf /home/joe
528  rm-rf /home/mary
529
530 C<glob> only works on simple guest paths and not on device names.
531
532 If you have several parameters, each containing a wildcard, then glob
533 will perform a Cartesian product.
534
535 =head1 COMMENTS
536
537 Any line which starts with a I<#> character is treated as a comment
538 and ignored.  The I<#> can optionally be preceeded by whitespace,
539 but B<not> by a command.  For example:
540
541  # this is a comment
542          # this is a comment
543  foo # NOT a comment
544
545 Blank lines are also ignored.
546
547 =head1 RUNNING COMMANDS LOCALLY
548
549 Any line which starts with a I<!> character is treated as a command
550 sent to the local shell (C</bin/sh> or whatever L<system(3)> uses).
551 For example:
552
553  !mkdir local
554  tgz-out /remote local/remote-data.tar.gz
555
556 will create a directory C<local> on the host, and then export
557 the contents of C</remote> on the mounted filesystem to
558 C<local/remote-data.tar.gz>.  (See C<tgz-out>).
559
560 To change the local directory, use the C<lcd> command.  C<!cd> will
561 have no effect, due to the way that subprocesses work in Unix.
562
563 =head1 PIPES
564
565 Use C<command E<lt>spaceE<gt> | command> to pipe the output of the
566 first command (a guestfish command) to the second command (any host
567 command).  For example:
568
569  cat /etc/passwd | awk -F: '$3 == 0 { print }'
570
571 (where C<cat> is the guestfish cat command, but C<awk> is the host awk
572 program).  The above command would list all accounts in the guest
573 filesystem which have UID 0, ie. root accounts including backdoors.
574 Other examples:
575
576  hexdump /bin/ls | head
577  list-devices | tail -1
578  tgz-out / - | tar ztf -
579
580 The space before the pipe symbol is required, any space after the pipe
581 symbol is optional.  Everything after the pipe symbol is just passed
582 straight to the host shell, so it can contain redirections, globs and
583 anything else that makes sense on the host side.
584
585 To use a literal argument which begins with a pipe symbol, you have
586 to quote it, eg:
587
588  echo "|"
589
590 =head1 HOME DIRECTORIES
591
592 If a parameter starts with the character C<~> then the tilde may be
593 expanded as a home directory path (either C<~> for the current user's
594 home directory, or C<~user> for another user).
595
596 Note that home directory expansion happens for users known I<on the
597 host>, not in the guest filesystem.
598
599 To use a literal argument which begins with a tilde, you have to quote
600 it, eg:
601
602  echo "~"
603
604 =head1 ENCRYPTED DISKS
605
606 Libguestfs has some support for Linux guests encrypted according to
607 the Linux Unified Key Setup (LUKS) standard, which includes nearly all
608 whole disk encryption systems used by modern Linux guests.  Currently
609 only LVM-on-LUKS is supported.
610
611 Identify encrypted block devices and partitions using L</vfs-type>:
612
613  ><fs> vfs-type /dev/sda2
614  crypto_LUKS
615
616 Then open those devices using L</luks-open>.  This creates a
617 device-mapper device called C</dev/mapper/luksdev>.
618
619  ><fs> luks-open /dev/sda2 luksdev
620  Enter key or passphrase ("key"): <enter the passphrase>
621
622 Finally you have to tell LVM to scan for volume groups on
623 the newly created mapper device:
624
625  vgscan
626  vg-activate-all true
627
628 The logical volume(s) can now be mounted in the usual way.
629
630 Before closing a LUKS device you must unmount any logical volumes on
631 it and deactivate the volume groups by calling C<vg-activate false VG>
632 on each one.  Then you can close the mapper device:
633
634  vg-activate false /dev/VG
635  luks-close /dev/mapper/luksdev
636
637 =head1 WINDOWS PATHS
638
639 If a path is prefixed with C<win:> then you can use Windows-style
640 paths (with some limitations).  The following commands are equivalent:
641
642  file /WINDOWS/system32/config/system.LOG
643
644  file win:/windows/system32/config/system.log
645
646  file win:\windows\system32\config\system.log
647
648  file WIN:C:\Windows\SYSTEM32\conFIG\SYSTEM.LOG
649
650 This syntax implicitly calls C<case-sensitive-path> (q.v.) so it also
651 handles case insensitivity like Windows would.  This only works in
652 argument positions that expect a path.
653
654 =head1 UPLOADING AND DOWNLOADING FILES
655
656 For commands such as C<upload>, C<download>, C<tar-in>, C<tar-out> and
657 others which upload from or download to a local file, you can use the
658 special filename C<-> to mean "from stdin" or "to stdout".  For example:
659
660  upload - /foo
661
662 reads stdin and creates from that a file C</foo> in the disk image,
663 and:
664
665  tar-out /etc - | tar tf -
666
667 writes the tarball to stdout and then pipes that into the external
668 "tar" command (see L</PIPES>).
669
670 When using C<-> to read from stdin, the input is read up to the end of
671 stdin.  You can also use a special "heredoc"-like syntax to read up to
672 some arbitrary end marker:
673
674  upload -<<END /foo
675  input line 1
676  input line 2
677  input line 3
678  END
679
680 Any string of characters can be used instead of C<END>.  The end
681 marker must appear on a line of its own, without any preceeding or
682 following characters (not even spaces).
683
684 Note that the C<-E<lt>E<lt>> syntax only applies to parameters used to
685 upload local files (so-called "FileIn" parameters in the generator).
686
687 =head1 EXIT ON ERROR BEHAVIOUR
688
689 By default, guestfish will ignore any errors when in interactive mode
690 (ie. taking commands from a human over a tty), and will exit on the
691 first error in non-interactive mode (scripts, commands given on the
692 command line).
693
694 If you prefix a command with a I<-> character, then that command will
695 not cause guestfish to exit, even if that (one) command returns an
696 error.
697
698 =head1 REMOTE CONTROL GUESTFISH OVER A SOCKET
699
700 Guestfish can be remote-controlled over a socket.  This is useful
701 particularly in shell scripts where you want to make several different
702 changes to a filesystem, but you don't want the overhead of starting
703 up a guestfish process each time.
704
705 Start a guestfish server process using:
706
707  eval `guestfish --listen`
708
709 and then send it commands by doing:
710
711  guestfish --remote cmd [...]
712
713 To cause the server to exit, send it the exit command:
714
715  guestfish --remote exit
716
717 Note that the server will normally exit if there is an error in a
718 command.  You can change this in the usual way.  See section
719 L</EXIT ON ERROR BEHAVIOUR>.
720
721 =head2 CONTROLLING MULTIPLE GUESTFISH PROCESSES
722
723 The C<eval> statement sets the environment variable C<$GUESTFISH_PID>,
724 which is how the I<--remote> option knows where to send the commands.
725 You can have several guestfish listener processes running using:
726
727  eval `guestfish --listen`
728  pid1=$GUESTFISH_PID
729  eval `guestfish --listen`
730  pid2=$GUESTFISH_PID
731  ...
732  guestfish --remote=$pid1 cmd
733  guestfish --remote=$pid2 cmd
734
735 =head2 REMOTE CONTROL DETAILS
736
737 Remote control happens over a Unix domain socket called
738 C</tmp/.guestfish-$UID/socket-$PID>, where C<$UID> is the effective
739 user ID of the process, and C<$PID> is the process ID of the server.
740
741 Guestfish client and server versions must match exactly.
742
743 =head1 PREPARED DISK IMAGES
744
745 Use the I<-N type> or I<--new type> parameter to select one of a set
746 of preformatted disk images that guestfish can make for you to save
747 typing.  This is particularly useful for testing purposes.  This
748 option is used instead of the I<-a> option, and like I<-a> can appear
749 multiple times (and can be mixed with I<-a>).
750
751 The new disk is called C<test1.img> for the first I<-N>, C<test2.img>
752 for the second and so on.  Existing files in the current directory are
753 I<overwritten>.
754
755 The type briefly describes how the disk should be sized, partitioned,
756 how filesystem(s) should be created, and how content should be added.
757 Optionally the type can be followed by extra parameters, separated by
758 C<:> (colon) characters.  For example, I<-N fs> creates a default
759 100MB, sparsely-allocated disk, containing a single partition, with
760 the partition formatted as ext2.  I<-N fs:ext4:1G> is the same, but
761 for an ext4 filesystem on a 1GB disk instead.
762
763 To list the available types and any extra parameters they take, run:
764
765  guestfish -N help | less
766
767 Note that the prepared filesystem is not mounted.  You would usually
768 have to use the C<mount /dev/sda1 /> command or add the
769 I<-m /dev/sda1> option.
770
771 If any I<-N> or I<--new> options are given, the guest is automatically
772 launched.
773
774 =head2 EXAMPLES
775
776 Create a 100MB disk with an ext4-formatted partition:
777
778  guestfish -N fs:ext4
779
780 Create a 32MB disk with a VFAT-formatted partition, and mount it:
781
782  guestfish -N fs:vfat:32M -m /dev/sda1
783
784 Create a blank 200MB disk:
785
786  guestfish -N disk:200M
787
788 =head1 PROGRESS BARS
789
790 Some (not all) long-running commands send progress notification
791 messages as they are running.  Guestfish turns these messages into
792 progress bars.
793
794 When a command that supports progress bars takes longer than two
795 seconds to run, and if progress bars are enabled, then you will see
796 one appearing below the command:
797
798  ><fs> copy-size /large-file /another-file 2048M
799  / 10% [#####-----------------------------------------] 00:30
800
801 The spinner on the left hand side moves round once for every progress
802 notification received from the backend.  This is a (reasonably) golden
803 assurance that the command is "doing something" even if the progress
804 bar is not moving, because the command is able to send the progress
805 notifications.  When the bar reaches 100% and the command finishes,
806 the spinner disappears.
807
808 Progress bars are enabled by default when guestfish is used
809 interactively.  You can enable them even for non-interactive modes
810 using I<--progress-bars>, and you can disable them completely using
811 I<--no-progress-bars>.
812
813 =head1 GUESTFISH COMMANDS
814
815 The commands in this section are guestfish convenience commands, in
816 other words, they are not part of the L<guestfs(3)> API.
817
818 =head2 help
819
820  help
821  help cmd
822
823 Without any parameter, this lists all commands.  With a C<cmd>
824 parameter, this displays detailed help for a command.
825
826 =head2 quit | exit
827
828 This exits guestfish.  You can also use C<^D> key.
829
830 @FISH_COMMANDS@
831
832 =head1 COMMANDS
833
834 @ACTIONS@
835
836 =head1 EXIT CODE
837
838 guestfish returns 0 if the commands completed without error, or
839 1 if there was an error.
840
841 =head1 ENVIRONMENT VARIABLES
842
843 =over 4
844
845 =item EDITOR
846
847 The C<edit> command uses C<$EDITOR> as the editor.  If not
848 set, it uses C<vi>.
849
850 =item GUESTFISH_PID
851
852 Used with the I<--remote> option to specify the remote guestfish
853 process to control.  See section
854 L</REMOTE CONTROL GUESTFISH OVER A SOCKET>.
855
856 =item HEXEDITOR
857
858 The L</hexedit> command uses C<$HEXEDITOR> as the external hex
859 editor.  If not specified, the external L<hexedit(1)> program
860 is used.
861
862 =item HOME
863
864 If compiled with GNU readline support, various files in the
865 home directory can be used.  See L</FILES>.
866
867 =item LIBGUESTFS_APPEND
868
869 Pass additional options to the guest kernel.
870
871 =item LIBGUESTFS_DEBUG
872
873 Set C<LIBGUESTFS_DEBUG=1> to enable verbose messages.  This has the
874 same effect as using the B<-v> option.
875
876 =item LIBGUESTFS_MEMSIZE
877
878 Set the memory allocated to the qemu process, in megabytes.  For
879 example:
880
881  LIBGUESTFS_MEMSIZE=700
882
883 =item LIBGUESTFS_PATH
884
885 Set the path that guestfish uses to search for kernel and initrd.img.
886 See the discussion of paths in L<guestfs(3)>.
887
888 =item LIBGUESTFS_QEMU
889
890 Set the default qemu binary that libguestfs uses.  If not set, then
891 the qemu which was found at compile time by the configure script is
892 used.
893
894 =item LIBGUESTFS_TRACE
895
896 Set C<LIBGUESTFS_TRACE=1> to enable command traces.
897
898 =item PAGER
899
900 The C<more> command uses C<$PAGER> as the pager.  If not
901 set, it uses C<more>.
902
903 =item TMPDIR
904
905 Location of temporary directory, defaults to C</tmp>.
906
907 If libguestfs was compiled to use the supermin appliance then the
908 real appliance is cached in this directory, shared between all
909 handles belonging to the same EUID.  You can use C<$TMPDIR> to
910 configure another directory to use in case C</tmp> is not large
911 enough.
912
913 =back
914
915 =head1 FILES
916
917 =over 4
918
919 =item $HOME/.guestfish
920
921 If compiled with GNU readline support, then the command history
922 is saved in this file.
923
924 =item $HOME/.inputrc
925
926 =item /etc/inputrc
927
928 If compiled with GNU readline support, then these files can be used to
929 configure readline.  For further information, please see
930 L<readline(3)/INITIALIZATION FILE>.
931
932 To write rules which only apply to guestfish, use:
933
934  $if guestfish
935  ...
936  $endif
937
938 Variables that you can set in inputrc that change the behaviour
939 of guestfish in useful ways include:
940
941 =over 4
942
943 =item completion-ignore-case (default: on)
944
945 By default, guestfish will ignore case when tab-completing
946 paths on the disk.  Use:
947
948  set completion-ignore-case off
949
950 to make guestfish case sensitive.
951
952 =back
953
954 =item test1.img
955
956 =item test2.img (etc)
957
958 When using the C<-N> or C<--new> option, the prepared disk or
959 filesystem will be created in the file C<test1.img> in the current
960 directory.  The second use of C<-N> will use C<test2.img> and so on.
961 Any existing file with the same name will be overwritten.
962
963 =back
964
965 =head1 SEE ALSO
966
967 L<guestfs(3)>,
968 L<http://libguestfs.org/>,
969 L<virt-cat(1)>,
970 L<virt-df(1)>,
971 L<virt-edit(1)>,
972 L<virt-list-filesystems(1)>,
973 L<virt-list-partitions(1)>,
974 L<virt-ls(1)>,
975 L<virt-make-fs(1)>,
976 L<virt-rescue(1)>,
977 L<virt-resize(1)>,
978 L<virt-tar(1)>,
979 L<virt-win-reg(1)>,
980 L<hexedit(1)>.
981
982 =head1 AUTHORS
983
984 Richard W.M. Jones (C<rjones at redhat dot com>)
985
986 =head1 COPYRIGHT
987
988 Copyright (C) 2009-2010 Red Hat Inc.
989 L<http://libguestfs.org/>
990
991 This program is free software; you can redistribute it and/or modify
992 it under the terms of the GNU General Public License as published by
993 the Free Software Foundation; either version 2 of the License, or
994 (at your option) any later version.
995
996 This program is distributed in the hope that it will be useful,
997 but WITHOUT ANY WARRANTY; without even the implied warranty of
998 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
999 GNU General Public License for more details.
1000
1001 You should have received a copy of the GNU General Public License
1002 along with this program; if not, write to the Free Software
1003 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.