Books
File System Hierarchy
/boot
- stores data that is used before the kernel begins executing user−mode program
- contains backup MBR data, boot data etc.
/dev
- contains device as files
sda, sda1, stdin, stdout, stderr, tty0, tty1 etc.
/proc
- virtual filesystem containing system information
- system memory, devices mounted, hardware configuration etc.
/etc
- contains all system related configuration files
/etc/hosts, /etc/sudoers, /etc/init.d, /etc/httpd etc.
/mnt
- mount point for filesystems or devices
/media
- mount point for removable media like CD-ROM, External HDD
/home
- contains user directories
/home/$USER
/root
- home directory for administrator “root”
/opt
- Reserved for all the software and add−on packages that are not part of the default installation
/bin
- commands for both system admin and non-admin users
- shell:
bash, csh etc.
- commands:
cp, mv, echo, ls, mkdir, cat etc.
/sbin
- executables for system maintenance, not for regular users
fdisk, ifconfig, init, route, reboot etc.
/usr
- contains by far the largest share of data on a system
- user programs like
telnet, ftp resides here
- large software packages must not use a direct subdirectory under the
/usr hierarchy
/usr/lib: program libraries
/usr/bin: vast majority of binaries like vi, gcc etc.
/usr/sbin: system administrator binaries like chroot, chown, adduser etc.
/usr/local:
/usr/local/bin: Locally compiled (installed) normal programs like node, python3
/usr/local/sbin: Locally compiled (installed) system programs like nginx, openvpn
/usr/share: shareable, architecture−independent files (docs, icons, fonts etc)
/usr/share/doc
/usr/share/man
/usr/include: header files for user space source code
/usr/src: linux source code
/var
- variable data like logging files, mail and printer spool, temporary files, lock files
- can be mounted on separate device for backup purposes
- Additional
/initrd: initial RAM Disk
/lost+found: rebooting after system crash, fsck tries to recover files and save here
/lib: kernel modules + shared library images (*.so) to boot system
/srv: site−specific data which is served by this system
/tmp: temporary files, should not delete data, can cause system crash
Software Installation
/proc
/etc
- User management
/etc/passwd: Stores core user account details like usernames, User IDs (UID), Group IDs (GID), home directories, and default shells
/etc/shadow: Holds securely hashed user passwords and password expiration policies, accessible only by root
/etc/group: Defines the system groups and lists which users belong to each group
/etc/sudoers: Controls which users or groups are granted administrative privileges via the sudo command
- Networking & DNS
/etc/hosts: Maps hostnames to IP addresses locally before DNS lookup
/etc/resolv.conf: Defines DNS resolvers (IP addresses of name servers)
/etc/hostname: Sets the system’s unique network hostname
- Core System Configuration
/etc/fstab: Lists filesystems and devices to mount automatically during boot
/etc/environment: Global environment variables available to all users/processes
/etc/os-release: Linux distribution and OS version information
- Automation & Services
/etc/crontab: Scheduled system-wide tasks
/etc/ssh/sshd_config: SSH server settings, including port numbers and remote login access rules
/etc/default/grub: Boot loader configuration (default OS selection, boot countdown timers, etc.)
Initial RAM Disk
- https://en.wikipedia.org/wiki/Initial_ramdisk
- Load temporary root file system into RAM
- make preparations before the real root file system can be mounted
- Ways to achieve:
initrd: initial RAM Disk
initramfs: Initial RAM Filesystem
man
/usr/share/man
man1: User programs
man2: System calls
man3: Library functions and subroutines
man4: Special files like /dev
man5: File formats
man6: Games
man7: Miscellaneous
man8: System administration Programs
# see man page of netstat
man netstat
# bind(2): see section 2 of bind
man 2 bind
# see man page of man
man man
Multiple man pages