Japanese to English: ファイル操作 | |
Source text - Japanese ファイル操作
ls
lsはカレントディレクトリの中身を記述する。作成したファイルやディレクトリが実際にディレクトリ内に存在するかどうかを確かめるために用いることができる。このコマンドは、GUIを用いる場合には存在し得ない。なぜなら、GUIを用いる場合には、ディレクトリに存在するファイルは常にアイコンとして表示されており、コマンドを用いて見る必要はないからである。一方、必要なときにのみ適宜ディレクトリの中身を書き出させることは、コンピュータにとってはアイコンを使うよりもはるかに楽な処理である。そのため、コンピュータの性能に応じて、GUIとCUIを使い分けることが望ましい。実際には、CUIでもGUIでも表示される情報には大差が無いため、コンピュータにとってやさしいCUIを用いる方が望ましいだろう(人間にとっては慣れるまで大変だが ... )。
lsの基本的な使い方は、
$ ls ディレクトリ名
となる。ディレクトリ名を省略したときには、カレントディレクトリが表示される。
lsにはいくつかのオプションがあるが、よく用いるものをまとめる。-lは、ファイルやディレクトリについてより詳細な情報を与える。情報は、パーミッション、ファイルサイズ、作成者、作成された時間、最後に変更された時間などである。実用上は、-lだけではなく、-hもつけるとファイルサイズが人間にとって読みやすい形でかかれるため、使いやすくなる。
-aは、ディレクトリ内にある全てのファイルを表示する。通常のlsでは、最初が.から始まるファイルやディレクトリは表示されない。これは、設定ファイルやアプリケーションが内部的に用いるファイルが毎回表示されると場所塞ぎだからである。これらが存在するかどうかを調べるためには、明示的に-aオプションを用いる必要がある。
-Rオプションは、ディレクトリを再帰的に下降してファイルを表示する。再帰的とは、ファイルが存在すればそれを表示し、ディレクトリが存在すればそのディレクトリに移動し、再びls -Rと同じ作業を行うという意味である。結局カレントディレクトリ以下に置かれているファイルが全て表示される。大きなディレクトリ内でこれを実行すると結果を得るのに時間がかかるため、控えた方がよいだろう。 | Translation - English File Management
ls
ls lists the contents of the current directory. It can be used to confirm that a file or folder exists inside the current directory. ls is not called when using a GUI. This is because when using a GUI, files are continuously displayed as icons, so the command is not needed to view them. Conversely, it is easier for the computer to output the contents of a directory only when needed, rather than using icons. Because of this, the desirability of using a GUI compared to a CUI depends on the performance of the computer. In practice, there is very little difference between the information displayed by a CUI and a GUI, so using a CUI for performance seems to be preferable (although this can be difficult for people to get used to).
The basic usage of ls is as follows:
$ ls directory_name
If the directory name is omitted, the contents of the current directory are listed.
There are a few options for ls; here is a summary of the most commonly used. -l returns detailed information about the listed files and directories. Information regarding permissions, file size, author, time of creation, and time last modified is provided. For practical purposes, using both -l and -h lists the file size in a format that is easy for humans to read.
-a lists all the files in the directory. Normally, ls will not list hidden files that start with “.”. This is to prevent configuration files and files used internally by applications from being listed every time the command is called. To check whether or not these files exist, it is necessary to explicitly use the -a option.
The -R option recursively descends the directory and lists files. “Recursively” means that if a file exists, it is listed; if a directory exists, the ls -R command is once again executed inside of that directory in the same way. In the end, all files below the currently directory are listed. This should not be used in large directories, as it will take time to get the result. |