The Linux Filesystem Explained を読む
/bin
/bin is the directory that contains binaries, that is, some of the applications and programs you can run.
You will find the ls program mentioned above in this directory, as well as other basic tools for making and removing files and directories, moving them around, and so on.
There are more bin directories in other parts of the file system tree, but we’ll be talking about those in a minute.
/bin
は実行可能なアプリケーションやプログラムのバイナリを置くディレクトリ.
ls
とかはここにあるしその他フォルダ作成したりするものもある.
(/usr/bin
とか) 他にもある bin
ディレクトリについては後述.
/boot
The /boot directory contains files required for starting your system.
Do I have to say this? Okay, I’ll say it: DO NOT TOUCH!.
If you mess up one of the files in here, you may not be able to run your Linux and it is a pain to repair.
On the other hand, don’t worry too much about destroying your system by accident: you have to have superuser privileges to do that.
/boot
はシステムを開始するために必須のファイルを置くディレクトリ.
なんか言うことがあるとすれば「触んな!」
/boot
以下のファイルを何か1つでも壊すと Linux が起動しなくなるし復旧はつらい作業になる.
とはいえスーパーユーザ権限がないと壊せないので心配しなくてもいい.
/dev
/dev contains device files.
Many of these are generated at boot time or even on the fly.
For example, if you plug in a new webcam or a USB pendrive into your machine, a new device entry will automagically pop up here.
/dev
はデバイス用のファイルを置くディレクトリ.
ほとんどのファイルは起動時もしくは必要になったタイミングで生成される.
例えば新しい Web カメラとか USB メモリを挿したときにそのデバイス用の新しいエントリが自動で増える.
/etc
/etc is the directory where names start to get confusing.
/etc gets its name from the earliest Unixes and it was literally “et cetera” because it was the dumping ground for system files administrators were not sure where else to put.
Nowadays, it would be more appropriate to say that etc stands for “Everything to configure,” as it contains most, if not all system-wide configuration files.
For example, the files that contain the name of your system, the users and their passwords, the names of machines on your network and when and where the partitions on your hard disks should be mounted are all in here.
Again, if you are new to Linux, it may be best if you don’t touch too much in here until you have a better understanding of how things work.
/etc
は名前のせいで分かりづらいディレクトリ...
ネーミングの由来は初期の Unix で, 管理者がどこに置いていいか分からないようなシステムファイルを置いていった場所なので, 文字通り "et cetera" なディレクトリ.
今では "etc" は "Everything to configure" の略だと言えるほど, 設定ファイルのほとんどが含まれている (システム内全部の設定ファイルがあるわけではないが).
例えばシステムの名前とか, ユーザとそのパスワードとか, ネットワーク上のマシン名とか, ハードディスク上のパーティションをいつどこにマウントするか?という情報とかは全部ここにある.
Linux に慣れてないなら, /etc
以下にあるファイルがどんな働きをするのかよく理解していないときに /etc
を触るのはやめたほうがいい.
/home
/home is where you will find your users’ personal directories.
In my case, under /home there are two directories: /home/paul, which contains all my stuff; and /home/guest, in case anybody needs to borrow my computer.
/home
は各ユーザ専用のディレクトリがいくつか入っている.
私 (著者 Paul Brown) の場合は, /home
の下には2つのディレクトリがある.
-
/home/paul
→ 自分用のユーザで使うファイルを色々入れている (paul ユーザ用) -
/home/guest
→ 誰かが私の PC を使う時用 (guest ユーザ用)
/lib
/lib is where libraries live.
Libraries are files containing code that your applications can use.
They contain snippets of code that applications use to draw windows on your desktop, control peripherals, or send files to your hard disk.
There are more lib directories scattered around the file system, but this one, the one hanging directly off of / is special in that, among other things, it contains the all-important kernel modules.
The kernel modules are drivers that make things like your video card, sound card, WiFi, printer, and so on, work.
/lib
はライブラリがあるところ.
ライブラリとはアプリケーションが使えるコードを含むファイルのこと.
ライブラリには例えば「デスクトップ上のウィンドウに描画する」「周辺機器を操作する」「HDD にファイルを送る」ためのコードが含まれる.
ファイルシステム上にはそこら中に lib
ディレクトリがあるが, /lib
は「カーネルモジュールが含まれている」という点で他より特別なもの.
カーネルモジュールとはビデオカード・サウンドカード・Wi-Fi・プリンタ等を機能させるためのドライバのこと.
/media
The /media directory is where external storage will be automatically mounted when you plug it in and try to access it.
As opposed to most of the other items on this list, /media does not hail back to 1970s, mainly because inserting and detecting storage (pendrives, USB hard disks, SD cards, external SSDs, etc) on the fly, while a computer is running, is a relatively new thing.
/media
は USB メモリ等を挿したときにそのストレージが自動でマウントされる場所.
他に紹介しているディレクトリとは対象的に, /media
はその由来を 1970 年代 (Unix 初期) に遡らない.
USB メモリ等を挿したそのときにストレージを認識する機能は比較的新しい機能であることが主な理由.
/mnt
The /mnt directory, however, is a bit of remnant from days gone by.
This is where you would manually mount storage devices or partitions.
It is not used very often nowadays.
/mnt
は過去の遺物.
ストレージデバイスやパーティションを手動でマウントするためのディレクトリ.
今はあまり使われてない.
/opt
The /opt directory is often where software you compile (that is, you build yourself from source code and do not install from your distribution repositories) sometimes lands.
Applications will end up in the /opt/bin directory and libraries in the /opt/lib directory.
A slight digression: another place where applications and libraries end up in is /usr/local, When software gets installed here, there will also be /usr/local/bin and /usr/local/lib directories.
What determines which software goes where is how the developers have configured the files that control the compilation and installation process.
/opt
は, 自分でソースコードを取ってきて自分でビルドして自分でインストールするソフトウェアの配置場所.
アプリケーションは /opt/bin
に, ライブラリは /opt/lib
に置かれることになる.
余談:
アプリケーションとライブラリをインストールする先は他にも /usr/local
がある.
/usr/local
にソフトウェアをインストールする場合は /usr/local/bin
と /usr/local/lib
が使われる.
ソフトウェアが /opt/
に入るのか /usr/local
に入るのかは, コンパイルやインストールのプロセスを作った人次第.
/proc
/proc, like /dev is a virtual directory.
It contains information about your computer, such as information about your CPU and the kernel your Linux system is running.
As with /dev, the files and directories are generated when your computer starts, or on the fly, as your system is running and things change.
/proc
は仮想ディレクトリ (/dev
と同様に).
ここには使用中のマシンの情報 (CPU の情報, 使用中のカーネルの情報など) が含まれる.
/dev
と同様に, システムの実行や情報の変更があったそのときにファイルやディレクトリが自動生成される.
/root
/root is the home directory of the superuser (also known as the “Administrator”) of the system.
It is separate from the rest of the users’ home directories BECAUSE YOU ARE NOT MEANT TO TOUCH IT.
Keep your own stuff in you own directories, people.
/root
はシステムのスーパーユーザ (所謂 "Administrator") のディレクトリ.
(/home/guest
のような) その他ユーザ用ディレクトリと区別されてる理由は, おめーらが触る必要がねえからだ!
よいこのみんなは, 自分のものは自分のディレクトリで管理しよう.
/run
/run is another new directory.
System processes use it to store temporary data for their own nefarious reasons.
This is another one of those DO NOT TOUCH folders.
/run
は新しいディレクトリ (/media
みたいな歴史的な意味?).
システムプロセスは悪質な理由で (← なんて表現すればいいんだこれ) 一時的なデータを /run
に保存する.
このディレクトリも絶対に触んじゃねーぞ!わかったな!
/sbin
/sbin is similar to /bin, but it contains applications that only the superuser (hence the initial s) will need.
You can use these applications with the sudo command that temporarily concedes you superuser powers on many distributions.
/sbin typically contains tools that can install stuff, delete stuff and format stuff.
As you can imagine, some of these instructions are lethal if you use them improperly, so handle with care.
/sbin
は /bin
と似ているが, スーパーユーザ専用のアプリケーションが入っている (そのためプレフィクスが s
).
多くの Linux ディストリビューションで, sudo
を使えば一時的に /sbin
内のアプリケーションを使用できる.
/sbin
は一般的に, 何かをインストールしたり削除したりフォーマットしたりするためのツール群が含まれる.
ご想像のとおり誤った使い方をするとまずいことになるため, 取り扱いには注意すること.
/usr
The /usr directory was where users’ home directories were originally kept back in the early days of UNIX.
However, now /home is where users kept their stuff as we saw above.
These days, /usr contains a mish-mash of directories which in turn contain applications, libraries, documentation, wallpapers, icons and a long list of other stuff that need to be shared by applications and services.
You will also find bin, sbin and lib directories in /usr.
What is the difference with their root-hanging cousins?
Not much nowadays.
Originally, the /bin directory (hanging off of root) would contain very basic commands, like ls, mv and rm; the kind of commands that would come pre-installed in all UNIX/Linux installations, the bare minimum to run and maintain a system.
/usr/bin on the other hand would contain stuff the users would install and run to use the system as a work station, things like word processors, web browsers, and other apps.
But many modern Linux distributions just put everything into /usr/bin and have /bin point to /usr/bin just in case erasing it completely would break something.
So, while Debian, Ubuntu and Mint still keep /bin and /usr/bin (and /sbin and /usr/sbin) separate; others, like Arch and its derivatives just have one “real” directory for binaries, /usr/bin, and the rest or *bins are “fake” directories that point to /usr/bin.
/usr
は Unix 初期の頃はユーザのホームディレクトリとして保持されていた.
しかし今は, ユーザは自分用のファイルを /home
に保管している.
最近は, /usr
は次のようなものを雑多に保管する場所になっている: アプリケーション, ライブラリ, ドキュメント, 壁紙, アイコン, アプリケーションとサービスで共有しておきたい何かしら, 等
/usr
以下には /usr/bin
とか /usr/sbin
とか /usr/lib
がある
/
直下にあるものとは何が違うか?
最近はそんなに大きな違いはない.