Linux Filesystem Hierarchy 之 /bin

1.3. /bin

Unlike /sbin, the bin directory containsseveral useful commands that are of use to both the systemadministrator as well as non-privilegedusers. It usually contains the shells like bash, csh, etc…. And commonly usedcommands like cp, mv, rm, cat, ls. For this reason and in contrast to /usr/bin,the binaries in this directory are considered to be essential. The reason forthis is that it contains essential system programs that must be available evenif only the partition containing / is mounted. This situation may arise shouldyou need to repair other partitions but have no access to shared directories(ie. you are in single user mode and hence have no network access). It alsocontains programs which boot scripts may depend on.

不像/sbin似的,bin目录包含了几个有用的命令,它们对于系统管理员和非授权的用户都很有用。Bin目录下通常包含shells,如,bash,csh,还有经常使用的命令,像cp, mv,rm,cat,ls。因为这个原因并且与/usr/bin对比而言,在本目录下的二进制文件一般认为是比较基础的。其中的原因是,该目录包含了基础的系统程序,即使在只有包含 / 的分区挂接的情况下,这些程序也必须可用。如果你需要修复其他的分区,而你又不能访问共享目录(就是说,你处于single user 模式,因此你没有网络访问),情形就变得更普遍了。/bin目录也包含启动脚本(boot scripts)所依赖的程序。

Compliance to the FSSTND means that thereare no subdirectories in /bin and that the following commands, or symboliclinks to commands, are located there.

遵从FSSTND意味着,在/bin中没有子目录,并且下面的命令,或者是这些命令的符号链接位于/bin目录中。

catUtility to concatenate files to standard output

chgrpUtility to change file group ownership

chmodUtility to change file access permissions

chownUtility to change file owner and group

cpUtility to copy files and directories

dateUtility to print or set the system data and time

ddUtility to convert and copy a file

dfUtility to report filesystem disk space usage

dmesgUtility to print or control the kernel message buffer

echoUtility to display a line of text

falseUtility to do nothing, unsuccessfully

hostname Utility to show or set thesystem’s host name

killUtility to send signals to processes

lnUtility to make links between files

loginUtility to begin a session on the system

lsUtility to list directory contents

mkdirUtility to make directories

mknodUtility to make block or character special files

moreUtility to page through text

mountUtility to mount a filesystem

mvUtility to move/rename files

psUtility to report process status

pwdUtility to print name of current working directory

rmUtility to remove files or directories

rmdirUtility to remove empty directories

sedThe `sed’ stream editor

shThe Bourne command shell

sttyUtility to change and print terminal line settings

suUtility to change user ID

syncUtility to flush filesystem buffers

trueUtility to do nothing, successfully

umountUtility to unmount file systems

unameUtility to print system information

If /bin/sh is not a true Bourne shell, itmust be a hard or symbolic link to the real shell command.

如果/bin/sh不是真正的Bourne shell,那么,它必须是真正的 shell 命令的硬链接或者符号链接。

The rationale behind this is because sh andbash mightn’t necessarily behave in the same manner. The use of a symbolic linkalso allows users to easily see that /bin/sh is not a true Bourne shell.

这背后的基本逻辑是,因为sh和bash不必要有相同的行为。符号链接的使用也允许用户很容易看到/bin/sh不是一个真正的Bourne shell.

The [ and test commands must be placedtogether in either /bin or /usr/bin.

[ 和 test命令必须一起出现在 /bin 或者/usr/bin中。

The requirement for the [ and test commandsto be included as binaries (even if implemented internally by the shell) isshared with the POSIX.2 standard.

因遵从与POSIX.2标准,要求将 [ 和 test命令作为二进制文件(即使是由shell内部实现的)包含进来。

The following programs, or symbolic linksto programs, must be in /bin if the corresponding subsystem is installed:

如果安装了相应的子系统,下面的程序,或者程序的符号链接必须在/bin中:

cshThe C shell (optional)

edThe `ed’ editor (optional)

tarThe tar archiving utility (optional)

cpioThe cpio archiving utility(optional)

gzipThe GNU compression utility (optional)

gunzipThe GNU uncompression utility (optional)

zcatThe GNU uncompression utility (optional)

netstat The network statistics utility(optional)

pingThe ICMP network test utility (optional)

If the gunzip and zcat programs exist, theymust be symbolic or hard links to gzip. /bin/csh may be a symbolic link to/bin/tcsh or /usr/bin/tcsh.

如果gunzip和zcat程序存在的话,它们必须是gzip的硬链接或者符号链接。/bin/csh可以是/bin/tcsh或者/usr/bin/tcsh的符号链接。

The tar, gzip and cpio commands have beenadded to make restoration of a system possible (provided that / is intact).

tar,gzip,和cpio命令已经被添加进来,使得系统的恢复(restoration)成为可能(提供了 / 不会被破坏)。

Conversely, if no restoration from the rootpartition is ever expected, then these binaries might be omitted (e.g., a ROMchip root, mounting /usr through NFS). If restoration of a system is plannedthrough the network, then ftp or tftp (along with everything necessary to getan ftp connection)

must be available on the root partition.

反过来说,如果不需要root分区的恢复功能,这些二进制就可以忽略了(例如,ROM芯片启动,通过NFS挂接/usr)。如果计划通过网络恢复系统,那么,root分区上必须有ftp,tftp(还有为了获得一个这样的链接所需要的条件一起)可用。

未经一番寒彻骨,焉得梅花扑鼻香

Linux Filesystem Hierarchy 之 /bin

相关文章:

你感兴趣的文章:

标签云: