Day 02: The Terminal, Shells & File Systems A developer explains the fundamental differences between terminal emulators and shell interpreters, covering Windows Terminal, PowerShell, and Command Prompt. The post details file system path tracking, hidden dotfiles, and essential CLI utilities like pwd, ls, and cd. Understand the interface boundary between Terminal Emulators and Shell Interpreters including Windows Terminal vs. PowerShell vs. CMD . Master File System path tracking, hidden dotfiles, and essential CLI utilities. Map system execution paths via global and local environment configurations. Terminal: The visual GUI wrapper. A window application that captures keyboard strokes, handles GPU text rendering, and manages tabs/panes. Shell: The command interpreter engine running inside the terminal. It evaluates text strings, processes scripts, issues system calls syscalls , and interacts with the OS Kernel. ┌────────────────────────────────────────────────────────┐ │ WINDOWS TERMINAL GUI The Visual Interface Window │ │ │ │ │ ├───► Tab 1: PowerShell Core Engine Modern │ │ ├───► Tab 2: Command Prompt Engine Legacy │ │ └───► Tab 3: WSL Ubuntu Linux Bash Core │ └───────────────────────────┬────────────────────────────┘ │ Raw Text & Input Streams ▼ ┌────────────────────────────────────────────────────────┐ │ SHELL INTERPRETER e.g., PowerShell / CMD │ │ └───► Parses input string commands into system tasks │ └───────────────────────────┬────────────────────────────┘ │ System Call Syscall ▼ ┌────────────────────────────────────────────────────────┐ │ OPERATING SYSTEM KERNEL │ │ └───► Interacts directly with underlying hardware │ └────────────────────────────────────────────────────────┘ While both are Windows shells hosted inside Windows Terminal, they belong to entirely different computing eras: Command Prompt cmd.exe : A legacy text shell maintained purely for backwards compatibility with 1980s MS-DOS. It pipelines data as PowerShell pwsh.exe : A modern, cross-platform scripting engine. It pipelines data as CMD APPROACH Text Parsing Stream dir ──► Outputs text characters ──► Requires complex string filters to read metadata. POWERSHELL APPROACH Object Oriented Get-ChildItem ──► Outputs File Objects ──► Programmatically query: file.Size, file.Extension Root / or C:\ : The absolute origin of the system storage hierarchy. Absolute Path: Complete address starting directly from the system root. C:\var\www\rextora\src\server.js Relative Path: Conditional paths computed dynamically based on your current working location. ../config/.env moves up one directory level, then steps into the config folder . Hidden Files Dotfiles : Administrative configuration layers starting with a period . . The OS restricts them from standard folder views by default to safeguard configuration states. .env , .gitignore , .profile . C:\ SYSTEM ROOT │ ┌────────┴────────┐ /bin /var │ /www │ /rextora ◄── Absolute Start │ ┌────────┴────────┐ /src /config │ │ server.js .env ◄── Hidden File ▲ ▲ │ │ └──── ../ ──────┘ ◄── Relative Step Direct textual manipulation of storage resources and active processes, completely bypassing graphical interfaces. These are the core commands a developer must know: pwd ──► Prints your current location: Displays the exact absolute path of the folder you are currently working inside. ls or dir on Windows ──► Lists directory contents: Scans and shows all files and folders contained within your current path. cd ──► Changes your directory: Moves your terminal's active focus forward into a target folder or backward cd .. to a parent folder. mkdir ──► Creates a new folder: Instantly allocates a brand-new, empty directory sector on your storage drive. touch or New-Item on Windows ──► Creates a blank file: Drops a new empty file pointer like app.js or .env directly into your current directory. cat ──► Views file contents: Prints the raw text inside a file directly onto your screen without launching an external text editor. rm ──► Permanently deletes files/folders: Erases target files instantly, bypassing the recycle bin completely rm -rf forcefully purges entire folder branches . Command Input ──► mkdir -p src/api │ ▼ ┌───────────────────────────────┐ │ DISK ALLOCATION │ │ Storage Sector Partitioned │ │ └── src/ │ │ └── api/ │ └──────────────┬────────────────┘ │ ▼ Next Command ──► touch src/api/index.js Creates empty file pointer $PATH Variable Environment Variables: Global key-value pairs allocated inside RAM, enabling running applications to fetch setup states like database credentials cleanly outside source code files. Real .env Example: Ini, TOML PORT=5000 DB URL="mongodb://localhost:27017/rextora" JWT SECRET="supersecretkey123" The $PATH Variable: A specialized system environment variable containing a colon-delimited string list of absolute directories where executable tool binaries live. Real $PATH Example Linux/Mac : Bash /usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin The Breakdown: /usr/local/bin : Where user-installed third-party tools live. /usr/bin : Standard system executables managed by the OS. /bin : Essential basic system utilities like ls , cp , mkdir . /opt/homebrew/bin : Mac Homebrew installation binaries. ┌─────────────────────────────────────────────────────────────────────────────┐ │ RAM ENVIRONMENT MEMORY BUFFER │ │ │ │ ├── PORT=5000 │ │ ├── DB URL="mongodb://localhost..." │ │ └── $PATH / Path Array: │ │ /usr/local/bin ──► /usr/bin ──► /bin ──► /opt/homebrew │ └─────────────────────────────────────────────────────────────────────────────┘ node , the shell loops through every folder in your $PATH array sequentially looking for node.exe . If the tool path is absent from the list, the shell drops a "command not found" / "not recognized as an internal or external command" exception. USER TYPES COMMAND ──► e.g., "node app.js" │ ▼ SHELL INTERPOLATION ──► Shell parses input text. │ ▼ PATH DIRECTORY SCAN ──► Scans folders listed inside global Path: │ ├───► Check 1: /usr/local/bin ──► Not Found ├───► Check 2: /usr/bin ──► FOUND EXECUTABLE └───► Skip remaining paths. │ ▼ KERNEL EXECUTION ──► Shell hands the executable binary to the OS Kernel. ✨ Decoupled Runtimes: Terminal applications manage user interface styling; shell platforms evaluate code execution and issue system hooks. ✨ Modern Shell Rule: CMD is legacy infrastructure. Rely strictly on PowerShell Core or Linux Bash for modern engineering workflows. ✨ Binary Mapping: Applications are unreachable by standard command calls unless their parent directory is securely mapped inside the system's global $PATH . Terminal vs Shell: Visual wrapper environment Windows Terminal vs. logic parser interfaces PowerShell, CMD, Bash . CMD vs. PowerShell: Legacy text-based stream pipeline vs. modern object-oriented pipeline. Paths: Absolute starts tracking directly from root / or C:\ ; relative calculates offsets from where your terminal window is working right now. Bin Lookups: The shell queries the systematic $PATH variable map to safely trace and wake up program files stored across the hard drive. Terminal vs. Shell: "The terminal is the monitor screen frame; the shell is the text engine processing logic inside that frame." CMD vs. PowerShell: "CMD is a typewriter pushing raw text lines; PowerShell is a conveyor belt transporting rich data objects." The $PATH Variable: