Linux
1. What Linux Is
Linux is a family of open-source, UNIX-like operating systems built around the Linux kernel first released by Linus Torvalds in 1991 and combined with GNU tools and utilities. Because the source code is freely available, hundreds of organisations package it into distributions (distros): Ubuntu, Fedora, Debian, Red Hat Enterprise Linux, CentOS, Arch, openSUSE, Linux Mint, Kali.
Key characteristics: multiuser and multitasking, portable (runs on desktops, servers, phones through Android, supercomputers, routers, smart TVs, IoT boards), monolithic but modular kernel (drivers loaded as modules), free and open source (GPL), powerful command line, stable and secure, and it dominates servers, cloud and the TOP500 supercomputers.
2. The File System Hierarchy — One Single Tree
Unlike Windows, Linux has no drive letters: every storage device is mounted somewhere inside a single tree that starts at the root /. Pathnames use the forward slash and are case sensitive (Notes.txt and notes.txt are different files).
/ root of the entire file system
├── bin/ sbin/ essential user and system binaries (commands)
├── boot/ kernel image (vmlinuz), initrd, GRUB configuration
├── dev/ device files (sda, tty0, null) — "everything is a file"
├── etc/ configuration text files (passwd, fstab, ssh, apt)
├── home/ user home directories: /home/raiyan
├── lib/ shared libraries used by binaries
├── media/ mnt/ mount points for USB drives and temporary mounts
├── opt/ optional/add-on software packages
├── proc/ sys/ virtual FS exposing kernel and process information
├── root/ home directory of the root user
├── tmp/ temporary files, cleared on reboot
├── usr/ user programs and libraries (usr/bin, usr/share)
└── var/ variable data: logs, mail spools, databases, caches
3. Permissions and Ownership
Each file has an owner, a group and permission bits for three classes — user (u), group (g), others (o):
-rwxr-xr-x 1 raiyan students 4096 Sep 21 10:20 report.sh
│└┬┘└┬┘└┬┘
│ │ │ └── others : r-x (read + execute)
│ │ └───── group : r-x
│ └──────── user : rwx (read + write + execute)
└────────── file type: - file, d directory, l symbolic link
| Symbolic | Octal | Meaning |
|---|---|---|
| rwx | 7 | read + write + execute |
| rw- | 6 | read + write |
| r-x | 5 | read + execute |
| r-- | 4 | read only |
| --- | 0 | no permission |
chmod 755 file = rwxr-xr-x; chmod 644 file = rw-r--r--; chown user:group file changes ownership; umask sets default permissions for new files. Directories need x to be entered, and the sticky bit on /tmp stops users deleting each other's files. Privileged operations are done as the root user via su or sudo.
4. Linux File Systems and Inodes
- ext2/ext3/ext4 — the classic family; ext3 added journaling, ext4 adds extents, larger volumes and faster checks. XFS, Btrfs and ZFS are used for large storage and snapshots. Linux also reads/writes FAT32, exFAT and NTFS for interoperability.
- inode — a fixed-size record that stores a file's metadata (owner, permissions, size, timestamps, data-block pointers) but not its name. A directory is simply a file containing pairs of (name, inode number). Commands reveal this:
ls -ishows inode numbers,df -ishows inode usage. - Hard link — another name pointing to the same inode (same file, data shared, link survives deletion of the other name, cannot cross file systems). Symbolic (soft) link — a small file containing a path to another file (can cross file systems and can dangle if the target is removed) — like a Windows shortcut.
5. The Shell and Essential Commands
bash (Bourne Again SHell) is the default on most distros; alternatives include zsh, ksh and fish. A command line follows command [options] [arguments], with wildcards (*, ?), redirection (>, >>, <, 2>) and pipes (|).
| Purpose | Commands |
|---|---|
| Navigation | pwd, cd, ls -l, ls -a |
| Files & folders | touch, mkdir -p, cp -r, mv, rm -rf, ln -s |
| Viewing content | cat, less, head, tail -f, grep |
| Searching | find / -name "*.log", locate, grep -r |
| Permissions | chmod, chown, chgrp, umask, sudo |
| Processes | ps aux, top, htop, kill -9 PID, nice, jobs, bg, fg |
| Disk & memory | df -h, du -sh, free -h, lsblk, mount |
| Archives | tar -czvf out.tar.gz dir, zip, unzip |
| Packages | apt install (Debian/Ubuntu), dnf install (Fedora/RHEL), snap |
| Services | `systemctl start |
| Help | man command, command --help, info |
| Network | ip a, ping, ssh user@host, scp, curl, wget |
Example pipeline — find the ten largest log files and show them:du -ah /var/log | sort -rh | head -n 10
6. Users, Processes and Services
- Users and groups are defined in
/etc/passwdand/etc/group; passwords (hashed) live in/etc/shadow.useradd,usermod,passwdmanage accounts. - Processes have a PID and a parent PID;
ps auxlists them,topmonitors them live,kill/pkillsignal them, and theinit/systemdprocess (PID 1) starts everything. Daemons are background services (sshd, cron, httpd). systemdmanages services, targets (runlevels), logs (journalctl) and dependencies on modern distros.
7. Linux vs Windows
| Basis | Linux | Windows |
|---|---|---|
| Licence | Open source (GPL), free | Proprietary, paid |
| Kernel | Monolithic, modular | Hybrid (NT) |
| File system root | Single / tree, no drive letters |
Drive letters C:, D: |
| Path separator / case | /, case sensitive |
\, case insensitive |
| Default file systems | ext4, XFS, Btrfs | NTFS, ReFS |
| Permissions | rwx bits, owner/group/other | ACLs per user/group |
| Configuration | Text files under /etc |
Registry + configuration files |
| Interface | CLI power (GUI optional) | GUI-first, CLI available |
| Software | Package managers (apt, dnf) | Installers, Microsoft Store, winget |
| Typical use | Servers, cloud, embedded, supercomputers | Desktops, offices, gaming |
8. Exam Points
- What is Linux? List its main features — 5 marks, frequent.
- Draw the Linux file system hierarchy and explain /etc, /home, /var, /bin, /dev, /tmp — 5-7 marks, very frequent.
- Explain Linux file permissions with the rwx notation and octal values; convert 755 and 644 — 5 marks, almost certain.
- What is an inode? Differentiate hard links and symbolic links — 5 marks.
- List any ten Linux commands with their purpose — 5 marks.
- Differentiate Linux and Windows file systems/organisation — 5 marks.
- What is a shell? Explain pipes and redirection with examples — 3-5 marks.