「man」は、「manual」(マニュアル)のことで、UNIXのコマンドの 使い方をオンラインで教えてくれます。
のように、manの後に使い方を知りたいコマンドを入力します。例えば、
% man ls (注意:以下、表示結果の一部) S(1) LS(1) 名前 ls, dir, vdir - ディレクトリの中身をリスト表示する 書式 ls [オプション] [file...] POSIX オプション [-CFRacdilqrtu1] GNU オプション (簡略形式): [-1abcdfghiklmnopqrstuvxABCD- FGHLNQRSUX] [-w cols] [-T cols] [-I pattern] [--block-size=SIZE] [--classify] [--color[={none,always,auto}]] [--file-type] [--full-time] [--format={across,commas,long,single-column,verbose,verti- cal}] [--human-readable] [--indicator-style={none,file- type,classify}] [--quoting-style={c,escape,lit- eral,shell,shell-always}] [--show-control-chars] [--si] [--sort={none,extension,size,time,version}] [--time={atime,access,ctime,status,use}] [--help] [--ver- sion] [--]
とlsの使い方についていろいろと教えてくれます。スペースキーを押して次のペー ジを順次表示させてください。前のページを表示するには「b」(バックという ことです)のキーを入力してください。つまり、
前のページを表示させる | b |
---|---|
次のページを表示させる | スペースキー |
表示を中止する(manコマンドの終了) | q |
UNIXのコマンドは オプションを単独で、または複数組み合わせる ことで様々な処理を実現してくれます。ですので、どんなUNIXの上級者でも、コ マンドの使い方を調べるときには、まずこのmanコマンドを使います。
また、manコマンドでは特定のキーワードを手がかりに、関連のあるコマンドを 表示してくれます。入力方法は、
と「k」オプションをつけます。たとえば、圧縮(英語では「compress」)に関 するコマンドを知りたい場合には、
と入力します。一気に表示されるので、1ページごとに表示させるために、
% man -k compress | more または % man -k compress | less (注意:以下、表示結果の一部) QPNGImagePacker [qpngimagepacker] (3qt) - Creates well-compressed PNG animation s TIFFWritedEncodedStrip [TIFFWriteEncodedStrip] (3t) - compress and write a stri p of data to an open TIFF file TIFFWritedEncodedTile [TIFFWriteEncodedTile] (3t) - compress and write a tile o f data to an open TIFF file bunzip2 (1) - a block-sorting file compressor, v1.0 bunzip2 [bzcat] (1) - a block-sorting file compressor, v1.0 bunzip2 [bzip2] (1) - a block-sorting file compressor, v1.0 bunzip2 [bzip2recover] (1) - a block-sorting file compressor, v1.0 bzcat (1) - decompresses files to stdout bzcat [bunzip2] (1) - decompresses files to stdout bzcat [bzip2] (1) - decompresses files to stdout bzcat [bzip2recover] (1) - decompresses files to stdout bzip2 (1) - a block-sorting file compressor, v1.0 bzip2 [bunzip2] (1) - a block-sorting file compressor, v1.0 bzip2 [bzcat] (1) - a block-sorting file compressor, v1.0 bzip2 [bzip2recover] (1) - a block-sorting file compressor, v1.0 cjpeg (1) - compress an image file to a JPEG file compress (1) - compress and expand data (version 4.1) compress [uncompress] (1) - compress and expand data (version 4.1) djpeg (1) - decompress a JPEG file to an image file
のように、関連のあるコマンドが左側に、各々のコマンドの概略が右側に 表示されます。表示されたコマンドの中から適切なものを選んで、 再度manコマンドで詳細を調べる、という流れでコマンドの使い方を調べていき ます。 manコマンドは非常に重要なコマンドですので、是非覚えてください。
「whatis」コマンドは、上記の「man -k コマンド」で表示されたコマンドの 概略を表示させるのに利用されます。例えば、「gzip」というコマンドの概略を 知りたい場合には、
% whatis gzip gzip (1) - compress or expand files
のように入力します。もっとも概略しか表示されませんので、詳細を知りたい場 合には、「man gzip」のようにmanコマンドを利用します。