Lullar    


ビデオジャパンは、最大でランク。

ls (UNIX) ls (UNIX)

出典: フリー百科事典『ウィキペディア(Wikipedia)』 Source: material may be challenged Wikipedia encyclopedia (Wikipedia) 』

ls (エルエス)はPOSIXおよびSingle UNIX Specificationで規定されているコマンドである。 ls (Eruesu) is a POSIX and Single UNIX Specification is a command has been stated. lsは「list segments」の略であり、 ファイルの一覧を表示するコマンドである。 ls is a "list segments" which stands for the command to display a list of files.

目次 Contents

[ 編集 ] 歴史 History

lsAT&T UNIXの最初のバージョンから存在していた。 ls is AT & T UNIX had existed since the first version. その名称は、 Multicsに存在した類似のコマンドから継承された。 Its name, Multics was inherited from a similar command exists. 現在使われている主な実装には、 フリーソフトウェア財団によるものとFreeBSDOpenBSDNetBSDDarwinなどのBSD系システムで用いられているものの2つがある。 The main implementation is currently used, and by the Foundation for Free Software FreeBSD, OpenBSD, NetBSD, Darwin and BSD systems, but are used in one of two. どちらもフリーソフトウェアであり、 オープンソースである。 And software-free and either the source is open.

[ 編集 ] 振る舞い Behavior

UNIX系のシステムには、現在ユーザが作業を行っているファイルシステム上の場所を表す「 カレントディレクトリ 」という概念がある。 UNIX-like systems, which represents the location of system files that are working on the users current directory "current" in the concept. lsは引数を伴わずに起動された場合、カレントディレクトリのファイルの一覧を表示する。 If ls is invoked without arguments, to display a list of files in current directory. 引数にカレントディレクトリ以外のディレクトリを指定した場合、そのディレクトリのファイル一覧を表示する。 If you specify a directory other than the directory to the current argument, to display a list of files in that directory. また、ディレクトリやファイルのリストを引数として指定することもでき、その場合はすべての指定されたファイルと、ディレクトリ内のファイルの一覧を表示する。 It can also be specified as an argument a list of directories and files, in which case all the specified files and to view a list of files in the directory.

. 」で始まるファイル名をもつファイル(ドットファイル)は標準では表示されず、表示するには明示的に-aオプションを指定する必要がある。 "." File with the file name starts with (dot files) are the standard will not be displayed, to show the need to explicitly specify the-a option.

オプションが指定されなかった場合、 lsはファイル名のみを表示する。 If no option is specified, ls will display only the file name. しかし、この形式ではファイルの種別、 パーミッション 、サイズなどの情報がわからない。 However, this type of format files, mission par, do not know the size and other information. lsには表示形式を変更するオプションが多く存在するが、もっとも一般的なものは次に挙げたものである。 ls has many options exist to change the display format is the most common ones are listed below.

  • -l :長い形式で表示する。 -l: long format to display. ファイル種別、パーミッション、 ハードリンクの数、所有者、グループ、サイズ、日付、ファイル名。 File type, mission par, the number of links hard, owner, group, size, date, file name.
  • -F :ファイルの性質を表す文字をファイル名の末尾に付加する。 -F: to add character to the end of the file name represents the nature of the file. 例えば「 * 」は実行可能ファイル、「 / 」はディレクトリを表し、通常のファイルは何も付加されない。 For example, "*" is an executable file, "/" represents a directory, the files are not usually add anything.
  • -a :「 . 」で始まるファイル名のものを含め、ディレクトリ内のすべてのファイルを表示する。 -a: "." including those that start with the file name to display all files in the directory.
  • -R :サブディレクトリ内のファイルを再帰的に表示する。 -R: to view files in subdirectories recursively. 従って、 ls -R /とするとシステムに存在するすべてのファイルを表示する。 Therefore, ls -R / to show all files that exist in the system.

一部の環境では、 --colorGNU ls )または-GFreeBSD ls )オプションを指定するとファイルの種別によって異なる色で表示される。 In some environments, - Color (GNU ls) or-G (FreeBSD ls) will be displayed in different colors depending on file type and options. 表示する色を決定する際、FreeBSDのlsではファイル種別とパーミッションのみで決定されるが、GNUのlsではそれに加え拡張子によっても色を変えることができる。 Determining the color display, FreeBSD for ls is determined only in the file type and permissions, GNU's ls can also change the color in addition to that extension.

このようなオプションを指定した場合、 lsの出力は次のようになる。 If you specify these options, ls will output the following.

 brw-r--r--    1 unixguy staff 64,  64 Jan 27 05:52 block brw-r - r - 1 unixguy staff 64, 64 Jan 27 05:52 block 
  crw-r--r--    1 unixguy staff 64, 255 Jan 26 13:57 character crw-r - r - 1 unixguy staff 64, 255 Jan 26 13:57 character 
  -rw-r--r--    1 unixguy staff     290 Jan 26 14:08 compressed.gz -rw-r - r - 1 unixguy staff 290 Jan 26 14:08 compressed.gz 
  -rw-r--r--    1 unixguy staff  331836 Jan 26 14:06 data.ppm -rw-r - r - 1 unixguy staff 331836 Jan 26 14:06 data.ppm 
  drwxrwx--x    2 unixguy staff      48 Jan 26 11:28 dir drwxrwx - x 2 unixguy staff 48 Jan 26 11:28 dir 
  -rwxrwx--x    1 unixguy staff      29 Jan 26 14:03 executable -rwxrwx - x 1 unixguy staff 29 Jan 26 14:03 executable 
  prw-r--r--    1 unixguy staff       0 Jan 26 11:50 fifo prw-r - r - 1 unixguy staff 0 Jan 26 11:50 fifo 
  lrwxrwxrwx    1 unixguy staff       3 Jan 26 11:44 link -> dir lrwxrwxrwx 1 unixguy staff 3 Jan 26 11:44 link -> dir 
  -rw-rw----    1 unixguy staff     217 Jan 26 14:08 regularfile -rw-rw ---- 1 unixguy staff 217 Jan 26 14:08 regularfile

lsには他にも多くのオプションが存在し、それらはmanpageで調べることができる。 the ls has many other options exist, they manpage can look at.

[ 編集 ] 使用例 Example

次の例は2つの異なる引数を与えられた時のlsコマンドの出力の違いを示している。 The following example was given two different arguments showing that the difference between the ls command output.

$ pwd $ Pwd
/home/fred / home / fred
$ ls -l $ Ls-l
drwxr--r--   1 fred  editors   4096  drafts drwxr - r - 1 fred editors 4096 drafts
-rw-r--r--   1 fred  editors  30405  edition-32 -rw-r - r - 1 fred editors 30405 edition-32
-r-xr-xr-x   1 fred  fred      8460  edit -r-xr-xr-x 1 fred fred 8460 edit
$ ls -F $ Ls-F
drafts/ drafts / 
edition-32 edition-32 
edit* edit *

ここでユーザfredホームディレクトリにはdraftsというディレクトリ、 edition-32という通常のファイルeditという実行可能ファイルが存在することがわかる。 Where the user fred's home directory is a directory called drafts, edition-32 file called normal, edit to know that there is an executable file. lsはユーザ、グループ、世界(それ以外)がファイルに対しどのようなパーミッション(権限)を持っているかを表現するために特別な記法を使っている。 ls is a user, group, world (otherwise) for any file permissions (rights) is a special notation to express what you have.

パーミッション部分の最初の文字はファイルの種別を表す。 The first character represents the type section of the file permissions.

文字 Character 意味 Meaning
- -- 通常のファイル Regular file
b b ブロックデバイス Block device
c c キャラクタデバイス Character device
d d ディレクトリ Directory
l l シンボリックリンク Symlink
pまたは= or p = 名前つきパイプまたはFIFO Named pipe or FIFO
s s ソケット Socket

残りの部分は3文字ごとのブロックに分けられ、 rwxはそれぞれ書き込み、読み込み、実行の権限が存在することを意味する。 The rest is divided into three blocks of each character, r, w, x will write each read, which means that there are rights of execution. 最初のブロックはユーザの、2つめのブロックはグループの、3つめのブロックは世界のパーミッションを表す。 The first block of the user, the second block of the two groups, the first three blocks represent the permissions of the world. 上の例では、ユーザfrededition-32を読み書きできるが、実行はできない。 In the above example, the user is fred edition-32 that can read and write, can not run. editorsグループのメンバーはそれ以外のユーザと同様、 edition-32を読めるが、書き込んだり実行したりすることはできない。 editors as well as members of other user groups, edition-32 is read, you can not write or perform.

[ 編集 ] 関連項目 See also

[ 編集 ] 外部リンク External links

  • Manpage of LS (JM Project) Manpage of LS (JM Project)
  • ls man page(FreeBSD版、英語) ls man page (FreeBSD version, English)
  • ls man page(OpenBSD版、英語) ls man page (OpenBSD version, English)
  • ls(1) man page(SunOS リファレンスマニュアル) ls (1) man page (SunOS Reference Manual)
  • ls(1) man page(HP-UX リファレンス) ls (1) man page (HP-UX Reference)
  • lsドキュメント(GNU版、英語) ls documents (GNU version, English)

ビデオジャパンは、最大でランク。




© Lullar