Linux /bin and its architecture!


Guide outline

1.1. Overview
1.2. The Root Directory
1.3. /bin
1.4. /boot
1.5. /dev
1.6. /etc
1.7. /home
1.8. /initrd
1.9. /lib
1.10. /lost+found
1.11. /media
1.12. /mnt
1.13. /opt
1.14. /proc
1.15. /root
1.16. /sbin
1.17. /usr
1.18. /var
1.19. /srv
1.20. /tm
2. Glossary

Additional Linux Resources

Here is a list of resources for learning Linux:

Resources for System Administrators

Linux System Admin Guide- What is Linux Operating System and how it works
Linux System Admin Guide- What are Directory Tree and Filesystem Hierarchy in Linux
Linux System Admin Guide- Introduction to Linux File Systems for System Admins
Linux System Admin Guide- Overview of Linux Virtual Memory and Disk Buffer Cache
Linux System Admin Guide- Best Practices for Monitoring Linux Systems
Linux System Admin Guide- Best Practices for Performing Linux Boots and Shutdowns
Linux System Admin Guide- Best Practices for Making and Managing Backup Operations

Resources for Linux Kernel Programmers

How Linux Operating System Memory Management works
Comprehensive Review of Linux Kernel Operating System Processes
Comprehensive Review of Linux File System Architecture and Management
What are mechanisms behind Linux Kernel task management
How Linux Kernel Sources and Functions work
Comprehensive look at how Linux Data Structures work

Hands-on Linux classes

Linux Operating System Distributions

Comprehensive list of all Linux OS distributions
Comprehensive list of all special purpose Linux distributions
Comprehensive list of all secure Linux distributions for cybersecurity professionals

One-to-One Live Linux Classes

Coding Bootcamps school offers One-to-One Live Linux Classes for Beginners.

 

1.3. /bin

Unlike /sbin, the bin directory contains several useful commands that are of use to both the system administrator as well as non-privileged users. It usually contains the shells like bash, csh, etc…. and commonly used commands 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 for this is that it contains essential system programs that must be available even if only the partition containing / is mounted. This situation may arise should you 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 also contains programs which boot scripts may depend on.

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

 

cat      Utility to concatenate files to standard output
chgrp    Utility to change file group ownership
chmod    Utility to change file access permissions
chown    Utility to change file owner and group
cp       Utility to copy files and directories
date     Utility to print or set the system data and time
dd       Utility to convert and copy a file
df       Utility to report filesystem disk space usage
dmesg    Utility to print or control the kernel message buffer
echo     Utility to display a line of text
false    Utility to do nothing, unsuccessfully
hostname Utility to show or set the system's host name
kill     Utility to send signals to processes
ln       Utility to make links between files
login    Utility to begin a session on the system
ls       Utility to list directory contents
mkdir    Utility to make directories
mknod    Utility to make block or character special files
more     Utility to page through text
mount    Utility to mount a filesystem
mv       Utility to move/rename files
ps       Utility to report process status
pwd      Utility to print name of current working directory
rm       Utility to remove files or directories
rmdir    Utility to remove empty directories
sed      The `sed' stream editor
sh       The Bourne command shell
stty     Utility to change and print terminal line settings
su       Utility to change user ID
sync     Utility to flush filesystem buffers
true     Utility to do nothing, successfully
umount   Utility to unmount file systems
uname    Utility to print system information

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

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

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

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

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

csh     The C shell (optional)
ed      The `ed' editor (optional)
tar     The tar archiving utility (optional)
cpio    The cpio archiving utility (optional)
gzip    The GNU compression utility (optional)
gunzip  The GNU uncompression utility (optional)
zcat    The GNU uncompression utility (optional)
netstat The network statistics utility (optional)
ping    The ICMP network test utility (optional)

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

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

Conversely, if no restoration from the root partition is ever expected,
then these binaries might be omitted (e.g., a ROM chip root, mounting /usr
through NFS). If restoration of a system is planned through the network,
then ftp or tftp (along with everything necessary to get an ftp connection)
must be available on the root partition.