File: guestfish-commands.pod

package info (click to toggle)
libguestfs 1%3A1.18.1-1%2Bdeb7u3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,156 kB
  • sloc: ansic: 282,408; ml: 22,707; sh: 16,121; perl: 5,946; java: 5,047; cs: 4,329; makefile: 3,191; haskell: 2,564; erlang: 1,510; python: 1,502; xml: 509; ruby: 217; pascal: 142; cpp: 11
file content (261 lines) | stat: -rw-r--r-- 7,281 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
=encoding utf8

=head2 alloc

=head2 allocate

 alloc filename size

This creates an empty (zeroed) file of the given size, and then adds so it
can be further examined.

For more advanced image creation, see L<qemu-img(1)> utility.

Size can be specified using standard suffixes, eg. C<1M>.

スパースなファイルを作成するには、代わりに L</sparse> を使用します。非スパースなディスクイメージを作成するには、
L</準備済みディスクイメージ> を参照してください。

=head2 copy-in

 copy-in local [local ...] /remotedir

C<copy-in> copies local files or directories recursively into the disk
image, placing them in the directory called C</remotedir> (which must
exist).  This guestfish meta-command turns into a sequence of L</tar-in> and
other commands as necessary.

Multiple local files and directories can be specified, but the last
parameter must always be a remote directory.  Wildcards cannot be used.

=head2 copy-out

 copy-out remote [remote ...] localdir

C<copy-out> copies remote files or directories recursively out of the disk
image, placing them on the host disk in a local directory called C<localdir>
(which must exist).  This guestfish meta-command turns into a sequence of
L</download>, L</tar-out> and other commands as necessary.

Multiple remote files and directories can be specified, but the last
parameter must always be a local directory.  To download to the current
directory, use C<.> as in:

 copy-out /home .

Wildcards cannot be used in the ordinary command, but you can use them with
the help of L</glob> like this:

 glob copy-out /home/* .

=head2 delete-event

 delete-event name

Delete the event handler which was previously registered as C<name>.  If
multiple event handlers were registered with the same name, they are all
deleted.

guestfish コマンドの C<event> および C<list-events> 参照。

=head2 display

 display filename

Use C<display> (a graphical display program) to display an image file.  It
downloads the file, and runs C<display> on it.

To use an alternative program, set the C<GUESTFISH_DISPLAY_IMAGE>
environment variable.  For example to use the GNOME display program:

 export GUESTFISH_DISPLAY_IMAGE=eog

L<display(1)> 参照。

=head2 echo

 echo [params ...]

パラメーターを端末に返します。

=head2 edit

=head2 vi

=head2 emacs

 edit filename

This is used to edit a file.  It downloads the file, edits it locally using
your editor, then uploads the result.

The editor is C<$EDITOR>.  However if you use the alternate commands C<vi>
or C<emacs> you will get those corresponding editors.

=head2 event

 event name eventset "shell script ..."

Register a shell script fragment which is executed when an event is raised.
See L<guestfs(3)/guestfs_set_event_callback> for a discussion of the event
API in libguestfs.

The C<name> parameter is a name that you give to this event handler.  It can
be any string (even the empty string) and is simply there so you can delete
the handler using the guestfish C<delete-event> command.

The C<eventset> parameter is a comma-separated list of one or more events,
for example C<close> or C<close,trace>.  The special value C<*> means all
events.

The third and final parameter is the shell script fragment (or any external
command) that is executed when any of the events in the eventset occurs.  It
is executed using C<$SHELL -c>, or if C<$SHELL> is not set then C</bin/sh
-c>.

The shell script fragment receives callback parameters as arguments C<$1>,
C<$2> etc.  The actual event that was called is available in the environment
variable C<$EVENT>.

 event "" close "echo closed"
 event messages appliance,library,trace "echo $@"
 event "" progress "echo progress: $3/$4"
 event "" * "echo $EVENT $@"

guestfish コマンドの C<delete-event> および C<list-events> 参照。

=head2 glob

 glob command args...

Expand wildcards in any paths in the args list, and run C<command>
repeatedly on each matching path.

L</WILDCARDS AND GLOBBING> 参照。

=head2 hexedit

 hexedit <filename|device>
 hexedit <filename|device> <max>
 hexedit <filename|device> <start> <max>

Use hexedit (a hex editor) to edit all or part of a binary file or block
device.

This command works by downloading potentially the whole file or device,
editing it locally, then uploading it.  If the file or device is large, you
have to specify which part you wish to edit by using C<max> and/or C<start>
C<max> parameters.  C<start> and C<max> are specified in bytes, with the
usual modifiers allowed such as C<1M> (1 megabyte).

For example to edit the first few sectors of a disk you might do:

 hexedit /dev/sda 1M

which would allow you to edit anywhere within the first megabyte of the
disk.

C</dev/sda1> にある ext2 ファイルシステムのスーパーブロックを編集するには、次のようにします:

 hexedit /dev/sda1 0x400 0x400

(assuming the superblock is in the standard location).

This command requires the external L<hexedit(1)> program.  You can specify
another program to use by setting the C<HEXEDITOR> environment variable.

L</hexdump> 参照。

=head2 lcd

 lcd directory

Change the local directory, ie. the current directory of guestfish itself.

Note that C<!cd> won't do what you might expect.

=head2 list-events

 list-events

List the event handlers registered using the guestfish C<event> command.

=head2 man

=head2 manual

  man

guestfish のマニュアルページを開きます。

=head2 more

=head2 less

 more filename

 less filename

ファイルを表示するために使用します。

デフォルトのビューアーは C<$PAGER> です。  しかし代替のコマンド C<less> を使用すると、明示的に C<less>
コマンドが使えます。

=head2 reopen

  reopen

Close and reopen the libguestfs handle.  It is not necessary to use this
normally, because the handle is closed properly when guestfish exits.
However this is occasionally useful for testing.

=head2 setenv

  setenv VAR value

環境変数 C<VAR> を文字列 C<value> に設定します。

環境変数の値を表示するには、次のようにシェルコマンドを使用します:

 !echo $VAR

=head2 sparse

 sparse filename size

This creates an empty sparse file of the given size, and then adds so it can
be further examined.

In all respects it works the same as the L</alloc> command, except that the
image file is allocated sparsely, which means that disk blocks are not
assigned to the file until they are needed.  Sparse disk files only use
space when written to, but they are slower and there is a danger you could
run out of real disk space during a write operation.

For more advanced image creation, see L<qemu-img(1)> utility.

Size can be specified using standard suffixes, eg. C<1M>.

=head2 supported

 supported

This command returns a list of the optional groups known to the daemon, and
indicates which ones are supported by this build of the libguestfs
appliance.

L<guestfs(3)/AVAILABILITY> 参照。

=head2 time

 time command args...

Run the command as usual, but print the elapsed time afterwards.  This can
be useful for benchmarking operations.

=head2 unsetenv

  unsetenv VAR

環境から C<VAR> を削除します。