2. Linux Filesystem Structure & File Management

Modules 3 & 4: Hierarchical directory tree, /etc, /var, /proc, file manipulation (cp, mv, rm, find, stat, du, df)

Module 1: Linux Filesystem & Directory Structure Hierarchy

Navigating standard Linux directory trees beginning at root /.

🇬🇧 English Definition

Linux uses a hierarchical filesystem beginning at root /. Important top-level directories include /etc (configuration), /var (variable data/logs), /home (user profiles), /boot (kernel boot files), /dev (device nodes), /proc and /sys (virtual kernel info).

🇮🇳 Hinglish Definition

Linux filesystem ka root / hota hai. /etc configuration, /var logs/changing data, /home user data, /boot boot files, /dev devices aur /proc,/sys system information ke liye important hain.

Core Concepts & Rules

  • /etc: Stores all system-wide configuration files.
  • /var: Holds dynamic data such as logs, mail queues, and web databases.
  • /proc & /sys: Virtual filesystems exposing kernel runtime status and hardware parameters.

🔍 Line-by-Line Command Breakdown

  1. Line 1: ls -ld / displays root directory detailed permissions.
  2. Line 2: ls -ld /etc /var /home /tmp inspects major system directory properties.
  3. Line 3: find /var/log -maxdepth 1 -type f lists log files under /var/log.
  4. Line 4: df -h checks disk space usage across mounted filesystems in human readable format.

🎯 Interview Focus & Questions

  • Q: What is /etc?
    A: The main directory for system-wide configuration files.
  • Q: What is /var?
    A: It stores variable data such as logs, caches and queues.
  • Q: What is /proc?
    A: A virtual filesystem exposing process and kernel information.
💻 Command Example & Terminal Output - Linux Filesystem & Directory Structure Hierarchy
ls -ld /
ls -ld /etc /var /home /tmp
find /var/log -maxdepth 1 -type f
df -h
mount
📤 Terminal Output / Interpretation:
drwxr-xr-x 19 root root 4096 Oct 4 18:00 / drwxr-xr-x 130 root root 12288 Oct 4 18:00 /etc drwxr-xr-x 14 root root 4096 Oct 4 18:00 /var Filesystem Size Used Avail Use% Mounted on /dev/sda1 40G 12G 26G 32% /

Module 2: File & Directory Management Operations

Mastering file creation, copying, moving, deletion, live search, and file inspection.

🇬🇧 English Definition

Master creating, copying, moving, deleting, finding and inspecting files. Understand file types, timestamps (atime, mtime, ctime), and wildcard pattern expansion.

🇮🇳 Hinglish Definition

Files ke create, copy, move, rename, delete, search aur inspect operations strong karo. rm -rf ko bahut carefully use karo.

Core Concepts & Rules

  • cp vs mv: cp creates a copy; mv moves or renames a file/directory.
  • find vs locate: find searches live filesystem dynamically; locate queries an indexed database.
  • stat: Displays detailed inode metadata, file permissions, and modification timestamps.

🔍 Line-by-Line Command Breakdown

  1. Line 1: touch file.txt creates empty file or updates timestamp.
  2. Line 2: cp file.txt /tmp/ copies file.txt to /tmp directory.
  3. Line 3: mv file.txt new.txt renames file.txt to new.txt.
  4. Line 4: mkdir -p project/src creates nested parent and child directories.
  5. Line 5: find /var/log -type f -name '*.log' searches for all .log files under /var/log.

🎯 Interview Focus & Questions

  • Q: cp vs mv?
    A: cp creates a duplicate copy; mv moves or renames a file/directory.
  • Q: find vs locate?
    A: find searches the filesystem live; locate searches an indexed database and may be stale.
💻 Command Example & Terminal Output - File & Directory Management Operations
touch file.txt
cp file.txt /tmp/
mv file.txt new.txt
rm new.txt
mkdir -p project/src
rmdir emptydir
find /var/log -type f -name "*.log"
stat document
du -sh /var/log
📤 Terminal Output / Interpretation:
/var/log/nginx/access.log /var/log/syslog File: document Size: 1024 Blocks: 8 IO Block: 4096 regular file Device: 801h/2049d Inode: 142586 Links: 1 45M /var/log