30

Is there a standard that I can refer to for the list of programs (e.g. cat, ls) that must be included in Linux?

Ron Vince
  • 1,442
  • 8
    busybox --list. Just kidding. – Mingye Wang Sep 25 '15 at 13:28
  • 8
    Linux is a kernel, it doesn't have commands. Some distributions of software built for that kernel follow the LSB standard, some other the Debian policy, most others none in particular. – Stéphane Chazelas Sep 25 '15 at 14:59
  • @StéphaneChazelas While I agree, I'd saying following the Debian policy is close to following LSB, since Debian supports LSB (if not by default, still via the lsb package). – muru Sep 25 '15 at 17:02
  • 2
    @muru Debian is giving up on LSB: https://lists.debian.org/debian-lsb/2015/09/msg00008.html – derobert Sep 25 '15 at 21:32
  • 1
    Technically you can't assume anything, because Linux-the-kernel gets used in a whole bunch of embedded or semi-embedded contexts where a full complement of shell utilities would be a pointless waste of space. If you're wondering what you can expect to be installed in a "normal" Unix-compatible shell environment, I'd look not at POSIX nor LSB but at the set of packages that Debian considers to be "required". Many essential system management tools, e.g. "ip", are not standardized at all. – zwol Sep 26 '15 at 14:42
  • @zwol I thought ip came from util-linux, so it should be same across Linux distros. Is there another source of ip? – muru Sep 26 '15 at 15:38
  • @muru ip comes from iproute2 on my Debian box, but that's not the point; the point is that ip (and a great many others - fsck, mke2fs, the LVM toolset, ...) aren't defined by LSB nor POSIX. – zwol Sep 26 '15 at 20:15

3 Answers3

41

The Linux Standard Base (LSB) has a list of applications:

[         du        install        mv            strings
ar        echo      install_initd  newgrp        strip
at        ed        ipcrm          nice          stty
awk       egrep     ipcs           nl            su
basename  env       join           nohup         sync
batch     expand    kill           od            tail
bc        expr      killall        passwd        tar
cat       false     ln             paste         tee
chfn      fgrep     locale         patch         test
chgrp     file      localedef      pathchk       tic
chmod     find      logger         pax           time
chown     fold      logname        pidof         touch
chsh      fuser     lp             pr            tput
cksum     gencat    lpr            printf        tr
cmp       getconf   ls             ps            true
col       gettext   lsb_release    pwd           tsort
comm      grep      m4             remove_initd  tty
cp        groupadd  mailx          renice        umount
cpio      groupdel  make           rm            uname
crontab   groupmod  man            rmdir         unexpand
csplit    groups    md5sum         sed           uniq
cut       gunzip    mkdir          sendmail      useradd
date      gzip      mkfifo         seq           userdel
dd        head      mknod          sh            usermod
df        hostname  mktemp         shutdown      wc
diff      iconv     more           sleep         xargs
dirname   id        mount          sort          zcat
dmesg     infocmp   msgfmt         split

Many of these are included as being part of the POSIX 1003.1-2001 standard, but the following are either only in LSB, or have differing specifications from POSIX:

ar       echo      hostname       more          sh
at       egrep     install        mount         shutdown
awk      fgrep     install_initd  msgfmt        su
batch    file      ipcrm          newgrp        sync
bc       fuser     ipcs           od            tar
chfn     gettext   killall        passwd        umount
chsh     grep      lpr            patch         useradd
col      groupadd  ls             pidof         userdel
cpio     groupdel  lsb_release    remove_initd  usermod
crontab  groupmod  m4             renice        xargs
df       groups    md5sum         sed           zcat
dmesg    gunzip    mknod          sendmail
du       gzip      mktemp         seq
muru
  • 72,889
9

Technically you can't assume anything will be present, because Linux-the-kernel gets used in a whole bunch of embedded or semi-embedded contexts where a full complement of shell utilities would be a pointless waste of space. It would not be out of the question, for instance, to build an IoT device whose filesystem contains a bootloader, a monolithic kernel, a custom /sbin/init that does everything the device will ever need to do, a few /dev entries, and nothing else.

The POSIX.1-2008 "Shell and Utilities" specification, also linked in muru's answer, is intended to standardize the shell as a programming language. It therefore doesn't include most of the system administration tools that one expects to be present on a "traditional" Unix installation. Unfortunately, this is also a visible remaining scar of the ancient schism between System V and BSD -- the tools you will find on Linux are not the same as those on FreeBSD or OSX or whatever. So, again, there's no reliable baseline.

To give an indication of what is missing from maru's answer, this is the set of packages that Debian (unstable) considers to be "required" (official definition: "Systems with only the required packages are probably unusable, but they do have enough functionality to allow the sysadmin to boot and install more software.") and that contribute files to /bin, /sbin, /usr/bin, or /usr/sbin. Those marked with an asterisk are not just "required", but "essential", which means other packaged software is allowed to assume its presence without depending on it.

base-passwd*            gzip*                   perl-base*
bash*                   hostname*               sed*
bsdutils*               initscripts             sensible-utils
coreutils*              libc-bin*               sysv-rc
dash*                   libpam-modules-bin      sysvinit-utils*
debianutils*            libpam-runtime          tar*
diffutils*              login*                  tzdata
dpkg*                   mawk¹                   util-linux*
e2fsprogs*              mount*                  xz-utils
findutils*              ncurses-bin*
grep*                   passwd

¹ awk-the-language is "essential", but the sysadmin can choose whether they want the "mawk" or "gawk" implementation.

And these are the packages considered "important" ditto; the official definition of "important" is "an experienced Unix person who found it missing would say 'What on earth is going on, where is foo?'":

adduser         cpio            ifupdown        man-db          vim-common
apt             cron            iproute2        procps          vim-tiny
apt-utils       debconf         iputils-ping    rsyslog         wget
aptitude        dmidecode       isc-dhcp-client systemd         whiptail
aptitude-common gnupg           kmod            systemd-sysv
at              gpgv            less            traceroute
bsdmainutils    groff-base      logrotate       udev

Notice that this second set includes critical system administration tools like ps and iproute2, but also things that might be completely unnecessary on some installations, like at and dmidecode. Both sets also contain things that are Debian-specific, like dpkg and apt.

Notice also that both sets together are not a superset of the functionality required by LSB (or POSIX+XSI for that matter): these utilities are missing:

ar              gencat          lpr             msgfmt          strings
bc              gettext         lsb_release     patch           strip
ed              install_initd   m4              pax             time
file            killall         mailx           remove_initd
fuser           lp              make            sendmail

The list of utilities that are in the above packages but not in LSB is long and tedious, but I'm including it anyway to underscore just how many "critical system administration tools" it includes.

accessdb                        mkhomedir_helper
add-shell                       mklost+found
addgroup                        mkswap
addpart                         modinfo
adduser                         modprobe
agetty                          mountpoint
apropos                         mt-gnu
apt                             namei
apt-cache                       ncal
apt-cdrom                       ncurses5-config
apt-config                      ncursesw5-config
apt-extracttemplates            neqn
apt-ftparchive                  networkctl
apt-get                         newusers
apt-key                         nisdomainname
apt-mark                        nologin
apt-sortpkgs                    nproc
aptitude-create-state-bundle    nroff
aptitude-curses                 nsenter
aptitude-run-state-bundle       nstat
arch                            numfmt
arpd                            oldfind
badblocks                       ownership
base64                          pam-auth-update
bash                            pam_getenv
bashbug                         pam_tally
biosdecode                      pam_tally2
blkdiscard                      pam_timestamp_check
blkid                           partx
blockdev                        perl
bootctl                         perl5.20.2
bridge                          pg
bsd-from                        pgrep
bsd-write                       pic
busctl                          ping
cal                             ping6
calendar                        pinky
captoinfo                       pivot_root
catchsegv                       pkill
catman                          pldd
cfdisk                          pmap
chage                           poweroff
chattr                          preconv
chcon                           printenv
chcpu                           printerbanner
chgpasswd                       prlimit
chpasswd                        ptx
chroot                          pwck
chrt                            pwconv
clear                           pwdx
clear_console                   pwunconv
colcrt                          raw
colrm                           rbash
column                          readlink
cpgr                            readprofile
cppw                            realpath
cron                            reboot
ctrlaltdel                      remove-shell
ctstat                          rename.ul
dash                            reset
debconf                         resize2fs
debconf-apt-progress            resizepart
debconf-communicate             rev
debconf-copydb                  rgrep
debconf-escape                  rmmod
debconf-set-selections          rmt-tar
debconf-show                    routef
debugfs                         routel
delgroup                        rsyslogd
delpart                         rtacct
deluser                         rtcwake
depmod                          rtmon
dhclient                        rtstat
dhclient-script                 run-parts
diff3                           runcon
dir                             runlevel
dircolors                       runuser
dmidecode                       savelog
dnsdomainname                   script
domainname                      scriptreplay
dpkg                            sdiff
dpkg-deb                        select-editor
dpkg-divert                     sensible-browser
dpkg-maintscript-helper         sensible-editor
dpkg-preconfigure               sensible-pager
dpkg-query                      service
dpkg-reconfigure                setarch
dpkg-split                      setsid
dpkg-statoverride               setterm
dpkg-trigger                    sfdisk
dumpe2fs                        sg
e2freefrag                      sha1sum
e2fsck                          sha224sum
e2image                         sha256sum
e2label                         sha384sum
e2undo                          sha512sum
e4defrag                        shadowconfig
eqn                             shred
expiry                          shuf
factor                          skill
faillog                         slabtop
fallocate                       snice
fdformat                        soelim
fdisk                           ss
filefrag                        start-stop-daemon
findfs                          stat
findmnt                         stdbuf
flock                           sulogin
fmt                             sum
free                            swaplabel
fsck                            swapoff
fsck.cramfs                     swapon
fsck.ext2                       switch_root
fsck.ext3                       sysctl
fsck.ext4                       systemctl
fsck.ext4dev                    systemd
fsck.minix                      systemd-analyze
fsck.nfs                        systemd-ask-password
fsfreeze                        systemd-cat
fstab-decode                    systemd-cgls
fstrim                          systemd-cgtop
geqn                            systemd-delta
getent                          systemd-detect-virt
getopt                          systemd-escape
getty                           systemd-hwdb
gpasswd                         systemd-inhibit
gpg                             systemd-machine-id-setup
gpg-zip                         systemd-notify
gpgsplit                        systemd-path
gpgv                            systemd-run
gpic                            systemd-stdio-bridge
groff                           systemd-tmpfiles
grog                            systemd-tty-ask-password-agent
grops                           tabs
grotty                          tac
grpck                           tailf
grpconv                         tarcat
grpunconv                       taskset
gtbl                            tbl
gzexe                           tc
halt                            tcptraceroute.db
hd                              telinit
helpztags                       tempfile
hexdump                         timedatectl
hostid                          timeout
hostnamectl                     tload
hwclock                         toe
i386                            top
iconvconfig                     traceproto.db
ifdown                          traceroute-nanog
ifquery                         traceroute.db
ifup                            traceroute6.db
infotocap                       troff
init                            truncate
insmod                          tset
installkernel                   tune2fs
invoke-rc.d                     tunelp
ionice                          tzconfig
ip                              tzselect
ipcmk                           udevadm
ischroot                        ul
isosize                         uncompress
journalctl                      unix_chkpwd
killall5                        unix_update
kmod                            unlink
last                            unshare
lastb                           unxz
lastlog                         update-alternatives
ldattach                        update-passwd
ldconfig                        update-rc.d
ldconfig.real                   uptime
ldd                             users
less                            utmpdump
lessecho                        vdir
lessfile                        vigr
lesskey                         vim.tiny
lesspipe                        vipw
lexgrog                         vmstat
lft.db                          vpddecode
line                            w.procps
link                            wall
linux32                         watch
linux64                         wdctl
lnstat                          wget
localectl                       whatis
login                           whereis
loginctl                        which
logrotate                       whiptail
logsave                         who
look                            whoami
lorder                          wipefs
losetup                         x86_64
lsattr                          xxd
lsblk                           xz
lscpu                           xzcat
lsipc                           xzcmp
lslocks                         xzdiff
lslogins                        xzegrep
lsmod                           xzfgrep
lspgpot                         xzgrep
lzmainfo                        xzless
mandb                           xzmore
manpath                         yes
mawk                            ypdomainname
mcookie                         zcmp
md5sum.textutils                zdiff
mesg                            zdump
mke2fs                          zegrep
mkfs                            zfgrep
mkfs.bfs                        zforce
mkfs.cramfs                     zgrep
mkfs.ext2                       zic
mkfs.ext3                       zless
mkfs.ext4                       zmore
mkfs.ext4dev                    znew
mkfs.minix                      zramctl
zwol
  • 7,177
  • 1
    Comprehensive. I'd like to note that Debian's adduser (and family) is ... Debian's. Arch uses Slackware's, which is very different. I'm only naming it since it doesn't sound Debian-specific, but is, nevertheless, like the ip command you mentioned earlier. – muru Sep 27 '15 at 17:00
4

The Wikipedia : list of Unix commands and Linuxconfig : Linux Commands are certainly worth a look.

However, many people tend to take a browse through at what's contained in the directories shown by echo $PATH and then look at the man page for more info.

steve
  • 21,892
  • Looking in the directories will tell you what's included in your specific distribution, it won't tell what should be. How would you tell by looking there that something is missing? – Barmar Sep 30 '15 at 19:23