Essential Linux Interview Guide: 100+ Questions on Architecture, Commands, and Security
This comprehensive guide covers over 100 essential Linux interview questions, detailing system overview, kernel components, file system hierarchy, shell scripting, common commands, security practices, and troubleshooting techniques to help candidates master Linux fundamentals and ace technical interviews.
Linux Overview
Linux is a free, open‑source Unix‑like operating system supporting multiple users, multitasking, multithreading, and both 32‑bit and 64‑bit hardware. It runs standard Unix tools, network protocols, and offers a stable, high‑performance environment.
Unix vs Linux
Open source : Linux source is freely available; Unix is proprietary.
Cross‑platform : Linux runs on many hardware platforms; Unix has limited portability.
GUI : Linux provides both command‑line and graphical interfaces; traditional Unix is command‑line only.
Hardware requirements : Linux works on modest hardware; Unix often requires specialized hardware.
User base : Linux is widely used by individuals and enterprises; Unix is common in large, security‑critical environments.
Linux Kernel and Components
The kernel manages hardware, memory, processes, devices, and file systems. Typical components include the kernel, shell, GUI, system utilities, and applications.
Linux Architecture
Divided into user space (applications, C library) and kernel space (system call interface, kernel, architecture‑dependent code). This separation enhances security and stability.
Bash vs DOS
Case‑sensitive commands vs case‑insensitive.
Path separator: / in Bash, \ in DOS.
File naming conventions differ.
Boot Process and Runlevels
Power‑on self‑test (POST) and BIOS initialization.
Load bootloader (GRUB, LILO).
Load Linux kernel.
Start init (PID 1).
Enter appropriate runlevel.
Login prompt.
Default runlevels: 0‑halt, 1‑single‑user, 2‑multi‑user (no network), 3‑multi‑user (network), 5‑graphical, 6‑reboot.
Inter‑Process Communication (IPC)
Pipes, named pipes (FIFO)
Signals
Message queues
Shared memory
Semaphores
Sockets
System Logs
Important log file: /var/log/messages aggregates system and security events.
Security Practices
Add non‑root users, disable root SSH login, change SSH port.
Use key‑based SSH authentication, disable password login.
Enable firewall, disable SELinux if not needed.
Install fail2ban to block brute‑force attacks.
Restrict access to trusted IPs, use VPN.
Limit outbound connections.
Common Attacks
CC (Connection‑Closing) attacks flood web pages; DDoS (Distributed Denial‑of‑Service) attacks use multiple compromised hosts to overwhelm resources.
Shell Scripting Basics
A shell script is a text file containing commands. The default login shell is /bin/bash. Common constructs include variables, if statements, loops ( for, while), case statements, functions, and I/O redirection.
# Example: change default shell
chsh -s /bin/bash usernameEssential Linux Commands
File Management
cat: concatenate and display files. chmod: change file permissions. chown: change file owner/group. cp: copy files/directories. mv: move or rename files. rm: remove files/directories. ln: create hard or symbolic links.
Directory Operations
ls: list directory contents with options for sorting, showing hidden files, and detailed view. mkdir: create directories (use -p for parent paths). pwd: print current working directory. cd: change directory. rmdir: remove empty directories.
Disk Usage
df: report file‑system disk space usage. du: estimate file and directory space usage.
Process Management
ps: display current processes. top: interactive view of running processes. kill: send signals to processes.
Network Tools
ifconfig/ ip: view/configure network interfaces. netstat: show network connections and routing tables. ping: test reachability of a host. telnet: remote login utility.
Package Management
rpm: manage Red Hat packages. yum: install, update, and remove packages.
Compression
tarwith -z (gzip) or -j (bzip2) for archiving. gzip, bzip2, unzip for compression/decompression.
Sample Interview Tasks
Write a script to copy character devices to /dev, create a group with 30 users, delete a range of user accounts, and modify files with sed to insert text around a pattern.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
