The GNU Core Utilities





I have recently been doing research for a book I am writing and the GNU Core Utilities have been showing up quite frequently. All SysAdmins use these utilities regularly, pretty much without thinking about them. There is also another set of basic utilities, util-linux, that we should also look at because they also are important Linux.

Together, these two sets of utilities comprise many of the most basic tools of the Linux System Administrator. These tasks include management and manipulation of text files, directories, data streams, various types of storage media, process controls, filesystems, and much more. The basic functions of these tools are the ones that allow SysAdmins to perform many of the tasks required to administer a Linux computer. These tools are indispensable because without them it is not possible to accomplish any useful work on a Unix of Linux computer.

GNU Coreutils

To understand the origins of the GNU Core Utilities we need to take a short trip in the Wayback machine to the early days of Unix at Bell Labs. Unix was originally written so that Ken Thompson, Dennis Ritchie, Doug McIlroy, and Joe Ossanna could continue with something they had started while working on a large multitasking and multi-user computer project called Multics. That little something was a game called “Space Travel.” As is true today, it always seems to be the gamers that drive forward the technology of computing. This new operating system was much more limited than Multics as only two users could login at a time, so it was called Unics. This name was later changed to UNIX.

Over time, UNIX turned out to be such a success, that Bell Labs began essentially giving it away it to universities, and later to companies, for the cost of the media and shipping. Back in those days, system level software was shared between organizations and programmers as they worked to achieve common goals within the context of system administration.

Eventually the PHBs at AT&T decided that they should start making money on Unix and started using more restrictive – and expensive – licensing. This was taking place at a time when software in general was becoming more proprietary, restricted, and closed. It was becoming impossible to share software with other users and organizations.

Some people did not like this and fought it with – free software. Richard M. Stallman, aka RMS, led a group of rebels who were trying to write an open and freely available operating system that they call the “GNU Operating System.” This group created the GNU Utilities but did not produce a viable kernel.

When Linus Torvalds first wrote and compiled the Linux kernel, he needed a set of very basic system utilities to even begin to perform marginally useful work. The kernel does not provide commands themselves or any type of command shell such as bash. It is useless by itself. So Linus used the freely available GNU Core Utilities and recompiled them for Linux. This gave him a complete operating system even though it was quite basic.

You can learn about all of the individual programs that comprise the GNU Utilities by entering the command info coreutils at a terminal command line. The following list of the core utilities is part of that info page. The utilities are grouped by function to make specific ones easier to find. Highlight the group you want more information on and press the Enter key.

 

* 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

There are 102 utilities in this list. It does cover many of the basic functions necessary to perform some basic tasks on a Unix or Linux host. However, many basic utilities are missing. For example, the mount and umount commands are not in this list. Those and many of the other commands that are not in the GNU Coreutils can be found in the util-linux collection.

util-linux

The util-linix package of utilities contains many of the other common commands that SysAdmins use. These utilities are distributed by the Linux Kernel Organization and virtually every These 107 commands were originally three separate collections, fileutils, shellutils, and textutils, which were combined into the single package, util-linux, in 2003. As you can see from the list below, they

agetty          fsck.minix      mkfs.bfs        setpriv 
blkdiscard      fsfreeze        mkfs.cramfs     setsid 
blkid           fstab           mkfs.minix      setterm 
blockdev        fstrim          mkswap          sfdisk 
cal             getopt          more            su 
cfdisk          hexdump         mount           sulogin 
chcpu           hwclock         mountpoint      swaplabel 
chfn            ionice          namei           swapoff 
chrt            ipcmk           newgrp          swapon 
chsh            ipcrm           nologin         switch_root 
colcrt          ipcs            nsenter         tailf 
col             isosize         partx           taskset 
colrm           kill            pg              tunelp 
column          last            pivot_root      ul 
ctrlaltdel      ldattach        prlimit         umount 
ddpart          line            raw             unshare 
delpart         logger          readprofile     utmpdump 
dmesg           login           rename          uuidd 
eject           look            renice          uuidgen 
fallocate       losetup         reset           vipw 
fdformat        lsblk           resizepart      wall 
fdisk           lscpu           rev             wdctl 
findfs          lslocks         RTC Alarm       whereis 
findmnt         lslogins        runuser         wipefs 
flock           mcookie         script          write 
fsck            mesg            scriptreplay    zramctl 
fsck.cramfs     mkfs            setarch

Note that some of these utilities have been deprecated and will likely fall out of the collection at some point in the future. You should check the Wikipedia reference for util-linux at the end of this article for some information on many of the utilities. The man pages can be used to learn the details of these commands.

Summary

These two collections of basic Linux utilities, the GNU Core Utilities and util-linux, together provide the basic utilities required to administer a basic Linux system. As I researched this article, I found several interesting utilities in this list that I never knew about. Many of these commands are seldom needed. But when you do they are indispensable.

Between these two collections there are over 200 Linux utilities. Linux has many more commands but these are the ones that are needed to manage the most basic functions of the typical Linux host.

Resources

  1. Wikipedia, History of Unix, https://en.wikipedia.org/wiki/History_of_Unix
  2. GNU Operating System, Core Utilities, https://www.gnu.org/software/coreutils/coreutils.html
  3. Wikipedia, GNU Core Utilities, https://en.wikipedia.org/wiki/GNU_Core_Utilities
  4. The coreutils info pages.
  5. Wikipedia, util-linux, https://en.wikipedia.org/wiki/Util-linux