有些人不喜欢这种情况,于是用自由软件来对抗。Richard M. Stallman(RMS),他带领着一群“反叛者”试图编写一个开放的、自由的可用操作系统,他们称之为 GNU 操作系统。这群人创建了 GNU 实用程序,但并没有产生一个可行的内核。
当 Linus Torvalds 开始编写和编译 Linux 内核时,他需要一套非常基本的系统实用程序来开始执行一些稍微有用的工作。内核并不提供命令或任何类型的命令 shell,比如 Bash,它本身是没有任何用处的,因此,Linus 使用了免费提供的 GNU 核心实用程序,并为 Linux 重新编译了它们。这让他拥有了一个完整的、即便是相当基本的操作系统。
你可以通过在终端命令行中输入命令 info coreutils
来了解 GNU 核心实用程序的全部内容。下面的核心实用程序列表就是这个信息页面的一部分。这些实用程序按功能进行了分组,以方便查找;在终端中,选择你想了解更多信息的组,然后按回车键。
-
* Output of entire files:: cat tac nl od base32 base64
-
* Formatting file contents:: fmt pr fold
-
* Output of parts of files:: head tail split csplit
-
* Summarizing files:: wc sum cksum b2sum md5sum sha1sum sha2
-
* Operating on sorted files:: sort shuf uniq comm ptx tsort
-
* Operating on fields:: cut paste join
-
* Operating on characters:: tr expand unexpand
-
* Directory listing:: ls dir vdir dircolors
-
* Basic operations:: cp dd install mv rm shred
-
* Special file types:: mkdir rmdir unlink mkfifo mknod ln link readlink
-
* Changing file attributes:: chgrp chmod chown touch
-
* Disk usage:: df du stat sync truncate
-
* Printing text:: echo printf yes
-
* Conditions:: false true test expr
-
* Redirection:: tee
-
* File name manipulation:: dirname basename pathchk mktemp realpath
-
* Working context:: pwd stty printenv tty
-
* User information:: id logname whoami groups users who
-
* System context:: date arch nproc uname hostname hostid uptime
-
* SELinux context:: chcon runcon
-
* Modified command invocation:: chroot env nice nohup stdbuf timeout
-
* Process control:: kill
-
* Delaying:: sleep
-
* Numeric operations:: factor numfmt seq
这个列表里有 102 个实用程序。它涵盖了在 Unix 或 Linux 主机上执行基本任务所需的许多功能。但是,很多基本的实用程序都缺失了,例如,mount
和 umount
命令不在这个列表中。这些命令和其他许多不在 GNU 核心实用程序中的命令可以在 util-linux 中找到。