はじめに
ls
コマンドは、本当は list (list directory contents) の略です。list segments の略という説は Multics 開発の関係者の発言で否定され根拠が削除されています。
Multicsを買収し後を引き継いだハネウェル (Honeywell)が出版した文書にはこうあります。
つまり The list command に割り当てられた省略形が ls
なんです。
「ls が list segments の略である」という説を唱えている信頼性が高い情報源はありません。ls を list の略として使っている証拠はいくつも見つかります。「諸説ある」は便利な言葉ですが、この件に関して言えば list 以外の「諸説」は見つかりません(あるというのならそれを教えてください)。この記事では、説得力がある発言として、Multics 開発の関係者である Tom Van Vleck の「ls はlist の略である」という発言」 を紹介しています。
万が一 Multics の ls が list segments の略だったとしても、Unix の話にそれを持ち込むのは間違いです。Unix には(Multics 用語の)segments はなく、ls コマンドもそれを出力しないからです。Unix の話に限定すれば Version 1 Unixの時点で list contents of directory です。
この記事の最後で紹介している「lsコマンドの簡単な歴史 - A Brief History of the 'ls' command」もぜひ参照ください。
ls コマンドとは?
ls(エルエス)
ls
コマンドは Unix 系オペレーティングシステムで使用されるコマンドであり、ファイルやディレクトリの一覧を表示するための基本的な機能を提供する。名称の由来は「list(列挙する)」または「list directory contents(ディレクトリコンテンツを列挙する)」とされている。
ls
コマンドは 1970 年代に登場した初期の Unix システムにおいて導入され、現在では Linux、macOS、BSD など多くの Unix 互換システムで利用可能である。利用者はコマンドラインインターフェイス(CLI)上で ls
を入力することで、指定したディレクトリ内の内容を確認できる。オプション(例: -l
, -a
)を組み合わせることで、詳細な情報表示や隠しファイルの表示など柔軟な操作が可能となる。
list segments の略という説が広まった理由
Wikipedia に書かれていた真偽不明の情報が発信源と言って間違いないでしょう。この情報は 2005 年の 3 月に英語版の Wikipedia に参照リンクなしで追加され、根拠がないことから 2013 年 8 月に削除されています。日本語版の Wikipedia では今も list segments の略であるという説明が残っています。
"list segments" が Wikipedia に追加されたときのコメントには、Multics で使われていた用語であると書かれています。しかし削除されたときのコメントには、Multics では ls を list segments の略として使っておらず、Multics の開発者もそう言っていないとして、2003 年 7 月のある会話へのリンクが紹介されています。
この一連のスレッドでは「List Segments」の略だという主張に対して、Unix 開発者側の Dennis Ritchie が持っている 1969 年の Multics Programming Manual には list (ls) と書いてあるという話をし、Multics 開発者側の Tom Van Vleck がそのとおりであると答える形で会話が進んでいます。
At least in the 1969 Multics Programming Manual I have,
the command is entitled
list
Names: list (ls), listotals(lt), listnames(ln)
with a bunch of options.
そもそも segments とはなに?
英語の意味の「区画」ではありません。「list segments」の略であると書いてある記事の一部は、セグメントの意味がわからず、区画や独自の解釈を行っているようです。Unix にセグメントはないので、この場の意味を説明できないわけですよね。セグメントとは Unix を開発した人たちが以前に開発に参加していた、Multics という OS の用語です。その OS でも ls
コマンドが使われていたため、Multics 用語を由来として扱っているようです。
セグメントは Multics 用語なので私は完全に理解していませんが、Multicsシステムでは、プログラムやデータを「セグメント」と呼ばれる単位に分割して管理しており、ファイルもまた「セグメント」の1つとして管理していたようです。つまり Unix で「すべてがファイル」と言われるように、Multics は「すべて(?)がセグメント」だった、ということのようです。ただし Multics でもディレクトリやファイルという用語が使われており、概念的にはディレクトリやファイルであり、その実装がセグメントという認識のようです。
list segments 削除までの流れと証拠
Wikipedia から list segments が削除されることとなるきっかけは 2007 年の会話です。出典なしの情報であり「疑わしい」レベルでしたが、最終的な結論が出る前に削除されたようです。
Wikipedia から削除されたおよそ 1 年後の 2014年の 10 月に、あるユーザーから証拠として Multics の list コマンドの機能が提示されました。
list
コマンドというのは実際にタイプできるコマンド名です。ls
コマンドは list
コマンドに与えられた省略形です。コマンドの機能の説明には「エントリータイプの引数を指定することでセグメントを出力できる」と書かれています。つまり ls
コマンドはディレクトリに含まれるさまざまなエントリをリストするためのコマンドで、セグメントはその中の1つでしかないということです。ls
コマンドがセグメント専用ではないというのであれば、ls が list segments の略というのはおかしな話です。これは十分な説得力があると私は感じます。
ls
コマンドのデフォルトは -file
であり,セグメント、マルチセグメントファイル、データマネジメントファイルが出力されることが次の内容からわかります。-branch
だと加えてディレクトリ、-all
だと加えてリンクもリストされるようです。
Syntax as a command: ls {entrynames} {-control_args}
Function: prints information about the entries in a single directory.
There are five entry types supported by list: segments, multisegment
files (MSFs), data management (DM) files, directories, and links.
Segments, DM files, and MSFs are referred to collectively as files;
segments, MSFs, DM files, and directories are referred to collectively
as branches.
Control arguments (entry type):
-segment, -sm
list segments.
-multisegment_file, -msf
list multisegment files.
-data_management_file, -dmf
lists data management files.
-file, -f
list information about files (i.e., segments, MSFs, and DM files).
(Default)
-directory, -dr
list directories.
-branch, -br
list information about branches (i.e., segments, MSFs, DM files, and
directories).
-link, -lk
list links.
-all, -a
list information about all entry types in the following order:
segments, MSFs, DM files, directories, and links.
Multics公式の書籍などのスキャン資料
2024-02-07 追記
いくつか資料を発見したので追記します。これで list segments の略ではないことは、完全に明らかになったことでしょう。その他 Multics 関連の資料はここにあります。
- Multics 公式サイト: https://www.multicians.org
- http://www.bitsavers.org/pdf/honeywell/large_systems/multics/
1966 - 1968: List, files, status
おそらく Multics の初期のコマンドです。後にコマンドが作り変えられたようで、コマンド体系やオプション体系が異なります。このときに ls という略称があったのかはよくわかりません。なにげにワイルドカードもあるようです。
- https://multicians.org/mspmtoc.html
-
https://multicians.org/mspm/bx-8-00.681017.file-system-commands.pdf
- (ファイルシステム全般の話)
- https://multicians.org/mspm/bx-8-01.681021.list-commands.pdf
1969: Multics Programming Manual
実際の書籍は発見していませんが(ここのどこかにあるかも? https://multicians.org/mspmtoc.html )、上の方ですでに書いたように
この一連のスレッドの中で Dennis Ritchie が所有している 1969 年の Multics Programming Manual に list (ls) と書いてあるとのことです。ちなみに 1969 年は Unix が誕生した年(Version 1 は 1971 年)です。
At least in the 1969 Multics Programming Manual I have,
the command is entitled
list
Names: list (ls), listotals(lt), listnames(ln)
with a bunch of options.
また Tom Van Vleck(Multics開発の関係者)の発言からは、
- Multicsの名前の省略規則は、母音を省き音節の先頭の子音を取るか、音節が1つだけの場合は最初の数個の子音を取る
- その名前は単に「list」だった
- ファイルをリストするのかセグメントをリストするのかは意図的に省略されていた
- 我々は「ファイルはセグメントであり、セグメントはファイルである。各文脈で適切な用語を選ぶのが熟練した Multician(Multicsの使い手)である」とよく言っていた
- 「セグメントシステム」ではなく「ファイルシステム」と呼んでいた
- Multicsの前身であるCTSSには、ファイルをリストする「LISTF」(慣例的な省略形は「LF」)があった
ということがわかります。
Dennis is correct. The Multics convention for name
abbreviation dropped vowels and took the leading
consonants of syllables, or if only one syllable, the
first few consonants.The name was just "list". Whether it listed files or
segments was deliberately omitted. We used to say that
"a file is a segment, and a segment is a file, and
you can tell an expert Multician because he chooses the
correct term in each context." We had a "file system,"
not a "segment system," for example.(The predecessor to Multics, CTSS, had a "LISTF" command
that listed files. Noel Morris and I wrote a command
abberviation program, and the customary abbreviation for
LISTF was LF.)
1974: New list command
後で気づいた以下のPDFでは Dennis Ritchie 所有の本に書いてあった「list (ls), listotals(lt), listnames(ln)」を置き換える新しいコマンドと記載されています)
-
https://multicians.org/mtbs/MTB-042.pdf
- February 12, 1974 Subject: Modifications to list commands.
-
https://multicians.org/mtbs/MTB-062.pdf
- April 17, 1974: Rewrite list' listnames' and listotals comands
-
https://multicians.org/mtbs/MTB-125.pdf
- October 2, 1974 Subject: New list command.
- 他にも色々https://multicians.org/mcr-index.html
これが、古い list コマンドなのではないか? なんとなく、最初は list で、新しい list コマンドができたときに ls という別名が使えるようになったような気がする。
1968年 MULTICS SYSTEM-PROGRAMMERS' MANUAL list, files, status,
以下にも list コマンドがある。
1969年 MULTICS CONDENSED GUIDE
1976: Multics Pocket Guide
Multics Pocket Guide: Commands and Active Functions, Apr 1976
1978: MULTICS CONCEPTS AND UTILIZATION
Honeywell Marketing Education
Level 68
MULTICS CONCEPTS AND UTILIZATION
Student Handbook Course Code F01
June 27, 1977
-
http://www.bitsavers.org/pdf/honeywell/large_systems/multics/F01_multicsIntroCourseOct78.pdf
-
104ページより
1980: Multics Pocket Guide: Commands and Active Functions,
1983: MULTICS COMMON COMMANDS
list command の説明の EXAMPLES には ls が書かれている
1985: HONEYWELL GUIDE TO MULTICS MANUALS
1987: MULTICS COMMANDS AND ACTIVE FUNCTiONS
この記事の冒頭のキャプチャ画像は 629 ページより
1987: Multics Command Level I/O redirection (pipes).
どうやら、Unix のパイプが逆輸入されたもよう。
If the token appears at the end of an active string the
output of the last command is returned as the active
function return string. For example,
the active string: [ls >udd>Multics>lib>s>*.pl1;|]
will return the output of the list command as the active
function return string.
他「the list command」多数
Multics の list
は短縮名 ls
を持っている
Multics の短縮名に関して、面白いことが書いてあります(太字は私によるもの)。
additional names
This feature is used to give Multics commands long names and short names: list has the short name ls, copy has cp, and move has mv, as well as page_multilevel_meters having pmlm. (The original convention for short names, "initial letter of each word in a command, augmented by succeeding consonants for a one-word command," is attributed to Don Widrig.)
(短い名前の元の規則である「コマンド内の各単語の最初の文字に、1 単語のコマンドの場合は後続の子音を追加する」は、Don Widrigによるものです。)
という理由で、list(1単語のコマンドの場合)は、最初の文字 l に 後続の子音 s が追加されたようです。
[BSG] Although there were many conventions of name syntax as time passed, short names were always an addition to long names. Unix's "tribute" to Multics of "keeping" ls, cp, etc., while throwing out all long names is in fact a misunderstanding bordering on a perversion.
Unix への批判(?)が書かれています(笑)
lsコマンドの簡単な歴史 - A Brief History of the 'ls' command
このページによると
- 初期の形式は
listf
と呼ばれ 1961 年の CTSS で利用できるようになった- In its earliest form it was called listf and was available on the Massachusetts Institute of Technology's Compatible Time Sharing System (CTSS) by July, 1961
- 1965年には
*
というパターンマッチが使えるようになった- In 1965, listf was extended to recognize ``*'' as a way to list all files that matched a specific pattern,
- CTSS が Multics に置き換えられたとき、
listf
コマンドはlist
に名前が変更され、オプションでls
に短縮できるようになった- When CTSS was superseded by Multics, the listf command was renamed to list, which could optionally be abbreviated to ls.
- (Multics の誕生は 1969 年。やっぱり
list
が本名でls
が別名だったんだ。)
- 1969年にベル研究所が Multics の開発から撤退し、Unix の開発が始まったとき、
list
の省略名であるls
のみが残った- When Bell Labs dropped out of Multics development in 1969 and work began on Unix, only the abbreviated name of list, ls, was retained.
ということがわかります。
信頼性は判断が難しいですが、
Copyright © 1999, Eric Fischer
Published in Issue 48 of Linux Gazette, December 1999
と書いてあるので、まだ Wikipedia に汚染されていない頃に書かれた記事ですね。
さいごに
Wikipedia の情報を鵜呑みにするのはやめましょう。特に日本語の内容は古く英語版で訂正された内容が今も残っていることが多々あります。Wikipedia は上手く使いこなせれば、信頼できるソースを見つけることができる有益な情報ですが、正しく使わなっければ役に立ちません。