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 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
|
=head1 名前
virt-ls - 仮想マシンのファイルの一覧表示
=head1 書式
virt-ls [--options] -d domname directory [directory ...]
virt-ls [--options] -a disk.img [-a disk.img ...] directory [directory ...]
古い形式:
virt-ls [--options] domname directory
virt-ls [--options] disk.img [disk.img ...] directory
=head1 説明
C<virt-ls> lists filenames, file sizes, checksums, extended attributes and more from a virtual machine or disk image.
Multiple directory names can be given, in which case the output from each is concatenated.
To list directories from a libvirt guest use the I<-d> option to specify the name of the guest. For a disk image, use the I<-a> option.
C<virt-ls> can do many simple file listings. For more complicated cases you may need to use L<guestfish(1)>, or write a program directly to the L<guestfs(3)> API.
=head1 例
仮想マシンにあるファイルおよびディレクトリーをすべて取得します:
virt-ls -R -d guest /
Linux 仮想マシンにある setuid または setgid プログラムを一覧表示します:
virt-ls -lR -d guest / | grep '^- [42]'
Linux 仮想マシンにあるすべての全体書き込み可能なディレクトリーを一覧表示します:
virt-ls -lR -d guest / | grep '^d ...7'
Linux 仮想マシンにあるすべての Unix ドメインソケットを一覧表示します:
virt-ls -lR -d guest / | grep '^s'
List all regular files with filenames ending in ‘.png’:
virt-ls -lR -d guest / | grep -i '^-.*\.png$'
ホームディレクトリにある 10MB より大きなファイルを表示するには:
virt-ls -lR -d guest /home | awk '$3 > 10*1024*1024'
7日以内に変更されたものをすべて検索します:
virt-ls -lR -d guest --time-days / | awk '$6 <= 7'
24時間以内に変更された通常のファイルを検索します:
virt-ls -lR -d guest --time-days / | grep '^-' | awk '$6 < 1'
=head2 DIFFERENCES IN SNAPSHOTS AND BACKING FILES
Although it is possible to use virt-ls to look for differences, since libguestfs E<ge> 1.26 a new tool is available called L<virt-diff(1)>.
=head1 出力モード
C<virt-ls> は 4 つの出力モードがあります。I<-l> および I<-R> オプションの異なる組み合わせにより制御されます。
=head2 簡単な一覧方法
簡単な一覧方法は通常の L<ls(1)> コマンドと似ています:
$ virt-ls -d guest /
bin
boot
[etc.]
=head2 ロング形式の一覧方法
I<-l> (I<--long>) オプションを用いると、出力は C<ls -l> コマンドのようになります(より具体的には C<guestfs_ll> 関数と似ています)。
$ virt-ls -l -d guest /
total 204
dr-xr-xr-x. 2 root root 4096 2009-08-25 19:06 bin
dr-xr-xr-x. 5 root root 3072 2009-08-25 19:06 boot
[etc.]
これはディレクトリーを表示するために有用ですが、他のプログラムにおいてこの出力を解析しないよう注意してください。代わりに L</再帰的なロング形式の一覧方法> を使用してください。
=head2 再帰的な一覧方法
I<-R> (I<--recursive>) オプションを用いると、C<virt-ls> はファイルおよびディレクトリーを再帰的に一覧表示します:
$ virt-ls -R -d guest /tmp
foo
foo/bar
[etc.]
この出力を生成するには、C<virt-ls> が C<guestfs_find0> 関数を実行して、C<\0> 文字を C<\n> に変換します。
=head2 再帰的なロング形式の一覧方法
Using I<-lR> options together changes the output to display directories recursively, with file stats, and optionally other features such as checksums and extended attributes.
Most of the interesting features of C<virt-ls> are only available when using I<-lR> mode.
The fields are normally space-separated. Filenames are B<not> quoted, so you cannot use the output in another program (because filenames can contain spaces and other unsafe characters). If the guest was untrusted and someone knew you were using C<virt-ls> to analyze the guest, they could play tricks on you by creating filenames with embedded newline characters. To B<safely> parse the output in another program, use the I<--csv> (Comma-Separated Values) option.
Note that this output format is completely unrelated to the C<ls -lR> command.
$ virt-ls -lR -d guest /bin
d 0555 4096 /bin
- 0755 123 /bin/alsaunmute
- 0755 28328 /bin/arch
l 0777 4 /bin/awk -> gawk
- 0755 27216 /bin/basename
- 0755 943360 /bin/bash
[etc.]
これらの基本的な項目は常に表示されます:
=over 4
=item type
ファイル形式。次のどれかです: C<-> (通常のファイル), C<d> (ディレクトリー), C<c> (キャラクターデバイス), C<b> (ブロックデバイス), C<p> (名前付きパイプ), C<l> (シンボリックリンク), C<s> (ソケット) or C<u> (不明)。
=item パーミッション
Unix パーティション。4 桁の8進数として表示されます。
=item 容量
ファイルの容量。 読みやすい形式の数値として表示する I<-h> または I<--human-readable> オプションが指定されていなければ、バイト単位で表示されます。
=item パス
ファイルまたはディレクトリの完全パス。
=item リンク
シンボリックリンクのみに対して、リンク先。
=back
I<-lR> モードでは、追加のコマンドラインオプションにより、さらなる項目の表示を有効にします。
I<--uids> フラグを用いると、これらの追加項目がパスの前に表示されます:
=over 4
=item uid
=item gid
ファイルの所有者の UID および GID (数値表記)。 これらは Unix 系の仮想マシンにおいてのみ意味があることに注意してください。
=back
I<--times> フラグがあると、これらの追加項目が表示されます:
=over 4
=item atime
アクセス日時。
=item mtime
最終変更日時。
=item ctime
最終属性変更日時。
=back
I<--time-t>, I<--time-relative> または I<--time-days> フラグのどれかが指定されていなければ、日付と時間の文字列として time 項目が表示されます。
I<--extra-stats> フラグを用いると、これらの追加項目が表示されます:
=over 4
=item device
The device containing the file (displayed as major:minor). This may not match devices as known to the guest.
=item inode
inode 番号。
=item nlink
ハードリンク数。
=item rdev
ブロックおよびキャラクタースペシャルファイルに対する、デバイス (メジャー:マイナーとして表示)。
=item ブロック
ファイルに割り当てられた 512 バイトブロック数。
=back
With the I<--checksum> flag, the checksum of the file contents is shown (only for regular files). Computing file checksums can take a considerable amount of time.
=head1 オプション
=over 4
=item B<--help>
簡単なヘルプを表示します。
=item B<-a> file
=item B<--add> file
Add I<file> which should be a disk image from a virtual machine. If the virtual machine has multiple block devices, you must supply all of them with separate I<-a> options.
ディスクイメージの形式は自動検知されます。 これを上書きして強制的に特定の形式を使用する場合、 I<--format=..> オプションを使用します。
=item B<-a URI>
=item B<--add URI>
リモートディスクを追加します。 L<guestfish(1)/リモートストレージの追加> 参照。
__INCLUDE:blocksize-option.pod__
=item B<--checksum>
=item B<--checksum=crc|md5|sha1|sha224|sha256|sha384|sha512>
Display checksum over file contents for regular files. With no argument, this defaults to using I<md5>. Using an argument, you can select the checksum type to use.
このオプションは I<-lR> 出力モードにおいてのみ効果があります。 上の L</RECURSIVE LONG LISTING> 参照。
=item B<-c> URI
=item B<--connect> URI
libvirt を使用していると、指定された I<URI> に接続します。 省略すると、デフォルトの libvirt ハイパーバイザーに接続します。
ゲストのブロックデバイスを直接指定していると((I<-a>))、libvirt は何も使用されません。
=item B<--csv>
Write out the results in CSV format (comma-separated values). This format can be imported easily into databases and spreadsheets, but read L</NOTE ABOUT CSV FORMAT> below.
=item B<-d> guest
=item B<--domain> guest
名前付きの libvirt 仮想マシンからすべてのディスクを追加します。 名前の代わりに仮想マシンの UUID を使用できます。
=item B<--echo-keys>
キーやパスフレーズを入力するとき、通常 virt-ls はエコーを無効化します。 そのため、入力内容を確認できません。 テンペスト攻撃の心配がなく、 部屋に誰も居なければ、 入力内容を確認するためにこのフラグを指定できます。
=item B<--extra-stats>
Display extra stats.
このオプションは I<-lR> 出力モードにおいてのみ効果があります。 上の L</RECURSIVE LONG LISTING> 参照。
=item B<--format=raw|qcow2|..>
=item B<--format>
I<-a> オプションは標準状態でディスクイメージの形式を自動検知します。 これを使用することにより、コマンドラインで後続の I<-a> オプションのディスク形式を強制的に指定できます。 引数なしで I<--format> を使用することにより、 後続の I<-a> オプションに対して自動検知に戻せます。
例:
virt-ls --format=raw -a disk.img /dir
forces raw format (no auto-detection) for F<disk.img>.
virt-ls --format=raw -a disk.img --format -a another.img /dir
forces raw format (no auto-detection) for F<disk.img> and reverts to auto-detection for F<another.img>.
仮想マシンのディスクイメージが信頼できない raw 形式である場合、 ディスク形式を指定するためにこのオプションを使用すべきです。 これにより、悪意のある仮想マシンにより起こり得る セキュリティ問題を回避できます (CVE-2010-3851)。
=item B<-h>
=item B<--human-readable>
読みやすい形式でファイル容量を表示します。
このオプションは I<-lR> 出力モードにおいてのみ効果があります。 上の L</RECURSIVE LONG LISTING> 参照。
__INCLUDE:key-option.pod__
__INCLUDE:keys-from-stdin-option.pod__
=item B<-m> dev[:mountpoint[:options[:fstype]]]
=item B<--mount> dev[:mountpoint[:options[:fstype]]]
指定されたマウントポイントにある、 名前付きパーティションまたは論理ボリュームをマウントします。
If the mountpoint is omitted, it defaults to F</>.
Specifying any mountpoint disables the inspection of the guest and the mount of its root and all of its mountpoints, so make sure to mount all the mountpoints needed to work with the filenames given as arguments.
If you don’t know what filesystems a disk image contains, you can either run guestfish without this option, then list the partitions, filesystems and LVs available (see L</list-partitions>, L</list-filesystems> and L</lvs> commands), or you can use the L<virt-filesystems(1)> program.
マウントパラメーターの三番目の (ほとんど使用されない) 項目は、 バックエンドのファイルシステムをマウントするために使用される マウントオプションの一覧です。 これが指定されていない場合、 マウントオプションは空文字列または C<ro> (I<--ro> フラグが使用されている場合) になります。
-m /dev/sda1:/:acl,user_xattr
このフラグを使用することは、 C<mount-options> コマンドを使用することと同等です。
パラメーターの四番目の項目は使用するファイルシステムドライバー (C<ext3> や C<ntfs> など) です。 これはほとんど必要ありません。 しかし、複数のドライバーがファイルシステムに対して有効である場合 (例: C<ext2> と C<ext3>)、 または libguestfs がファイルシステムを誤検知している場合、 これは有用です。
=item B<-l>
=item B<--long>
=item B<-R>
=item B<--recursive>
Select the mode. With neither of these options, C<virt-ls> produces a simple, flat list of the files in the named directory. See L</SIMPLE LISTING>.
C<virt-ls -l> produces a "long listing", which shows more detail. See L</LONG LISTING>.
C<virt-ls -R> produces a recursive list of files starting at the named directory. See L</RECURSIVE LISTING>.
C<virt-ls -lR> produces a recursive long listing which can be more easily parsed. See L</RECURSIVE LONG LISTING>.
=item B<--times>
時間の項目を表示します。
このオプションは I<-lR> 出力モードにおいてのみ効果があります。 上の L</RECURSIVE LONG LISTING> 参照。
=item B<--time-days>
Display time fields as days before now (negative if in the future).
Note that C<0> in output means "up to 1 day before now", or that the age of the file is between 0 and 86399 seconds.
このオプションは I<-lR> 出力モードにおいてのみ効果があります。 上の L</RECURSIVE LONG LISTING> 参照。
=item B<--time-relative>
Display time fields as seconds before now (negative if in the future).
このオプションは I<-lR> 出力モードにおいてのみ効果があります。 上の L</RECURSIVE LONG LISTING> 参照。
=item B<--time-t>
Display time fields as seconds since the Unix epoch.
このオプションは I<-lR> 出力モードにおいてのみ効果があります。 上の L</RECURSIVE LONG LISTING> 参照。
=item B<--uids>
UID と GID の項目を表示します。
このオプションは I<-lR> 出力モードにおいてのみ効果があります。 上の L</RECURSIVE LONG LISTING> 参照。
=item B<-v>
=item B<--verbose>
デバッグ用の冗長なメッセージを有効にします。
=item B<-V>
=item B<--version>
バージョン番号を表示して、終了します。
=item B<-x>
libguestfs API 呼び出しのトレースを有効にします。
=back
=head1 旧形式のコマンドライン引数
前のバージョンの virt-ls により、次のどちらも書くことができます:
virt-ls disk.img [disk.img ...] /dir
または
virt-ls guestname /dir
whereas in this version you should use I<-a> or I<-d> respectively to avoid the confusing case where a disk image might have the same name as a guest.
互換性のため古い形式がまだサポートされています。
=head1 CSV 形式に関する注意
Comma-separated values (CSV) is a deceptive format. It I<seems> like it should be easy to parse, but it is definitely not easy to parse.
神話: ただコンマで項目を区切る。 真実: これは正しく動き I<ません>。この例は 2 つの列があります:
"foo,bar",baz
神話: 同時にファイルの 1 行を読み込みます。 真実: これは正しく動き I<ません>。この例は 1 つの行があります:
"foo
bar",baz
For shell scripts, use C<csvtool> (L<https://github.com/Chris00/ocaml-csv> also packaged in major Linux distributions).
For other languages, use a CSV processing library (eg. C<Text::CSV> for Perl or Python’s built-in csv library).
Most spreadsheets and databases can import CSV directly.
=head1 終了ステータス
このプログラムは、成功すると 0 を、エラーがあると 0 以外を返します。
=head1 関連項目
L<guestfs(3)>, L<guestfish(1)>, L<virt-cat(1)>, L<virt-copy-out(1)>, L<virt-diff(1)>, L<virt-tar-out(1)>, L<http://libguestfs.org/>.
=head1 著者
Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2009-2023 Red Hat Inc.
|