Your Linux
Interview
Cheat Sheet:
Mas te r Sy st e m
& N e tw o rk
Fund a m en tals page 01
@JyotiSsahu
1. What is Linux?
Linux is a free, open-source, Unix-like operating system developed by
Linus Torvalds. It uses a monolithic kernel and powers everything from
servers and cloud infrastructure to mobile devices and embedded
systems. It supports multiple hardware platforms like x86, ARM, and
SPARC.
2. Explain the basic features of Linux OS
Free and Open Source: No licensing cost; fully customizable.
Secure: Uses user permissions, firewalls, SELinux, and auditing tools.
Multi-language support: Ideal for global teams.
Dual Interfaces: Offers both CLI (for automation) and GUI (for
accessibility).
Software Repositories: Easy to install/update packages securely via apt,
yum, or dnf.
3. Name some popular Linux distributions
Ubuntu & Debian: Common in cloud and DevOps labs.
RedHat & CentOS: Enterprise-grade, often used in production.
Fedora: Cutting-edge features, upstream of RHEL.
4. What are the major differences between Linux and Windows?
Feature Linux Windows
Cost Free and open-source Paid, proprietary
Security Strong user-based per More exposed to malw
File System Case-sensitive Case-insensitive
Path Syntax Uses / Uses \
Kernel Type Monolithic kernel Hybrid/microkernel
page 02
@JyotiSsahu
5. Define the basic components of
Linux
Kernel: Core of the OS, interfaces with hardware.
Shell: Command-line interpreter (e.g., bash).
GUI: Optional graphical interface (like GNOME).
Application Programs: Tools like vim, docker, ssh.
System Utilities: Services and helpers (cron, systemctl,
journalctl).
6. Explain file permissions in Linux
There are three permissions:
Read (r): View file contents.
Write (w): Modify or delete.
Execute (x): Run scripts or binaries.
Permissions are defined for:
User (owner)
Group
Others
Example: chmod 755 = owner (rwx), group (rx), others (rx)
7. What is the Linux Kernel? Is it legal to edit it?
The Linux kernel is the core of the OS — it manages memory,
processes, hardware, and I/O. It’s open-source and licensed
under the GPL (General Public License) — meaning you can
legally view, modify, and redistribute it.
8. Explain LILO
LILO (Linux Loader) is a legacy boot loader for Linux. It loads the
Linux kernel into memory and starts the OS during boot. Today,
it’s largely replaced by GRUB, which supports more modern
features.
page 03
@JyotiSsahu
9. What is Shell in Linux?
A shell is the interface between the user and the Linux kernel. Popular
shells include:
bash: Most common, default in many distros.
zsh: Feature-rich, modern shell.
csh/ksh: Script-friendly, older shells.
fish: Beginner-friendly with smart suggestions.
🔧 DevOps relevance:
You’ll write scripts, automate tasks, and configure pipelines using
the shell daily.
10. What is a root account?
The root account is the superuser in Linux with unrestricted system
access. It can install packages, modify system files, and manage all
users.
🔐 Pro Tip:
In production, use sudo instead of logging in directly as root — safer
and auditable.
11. Describe CLI and GUI in Linux
CLI (Command Line Interface): Text-based interface where users
interact using commands (e.g. Bash, Zsh). Ideal for automation,
scripting, and remote management.
GUI (Graphical User Interface): Visual interface with windows,
menus, icons (e.g. GNOME, KDE). Easier for beginners, but less
efficient for DevOps tasks.
12. What is Swap Space?
Swap is virtual memory on disk used when RAM is full. It allows
Linux to keep running by offloading inactive pages, preventing
crashes.
page 04
@JyotiSsahu
13. Difference Between Hard Links and Soft Links
Feature Hard Link Soft (Symbolic) Link
Points to File’s data/inode File name/path
Inode Same as original Different
Works if original deleted? Yes No (becomes broken)
Can link directories? No Yes
Memory usage Lower Slightly higher
14. How to Create a Symbolic Link in Linux
Use ln -s <target_file> <link_name>
Example:
ln -s /var/log/nginx/access.log nginx-log
15. What Are Standard Streams in Linux?
stdin (0): Input — usually from keyboard or a file
stdout (1): Output — normally to terminal
stderr (2): Errors — separate from stdout
Used in redirection:
command > out.txt 2> err.txt
16. How to Mount and Unmount Filesystems
Identify disk: lsblk or fdisk -l
Create mount point: mkdir /mnt/data
Mount: sudo mount /dev/sdb1 /mnt/data
Unmount: sudo umount /mnt/data
page 05
@JyotiSsahu
17. How to Troubleshoot Network Issues in Linux
Check interface: ip a or ifconfig
Test connectivity: ping 8.8.8.8, ping google.com
Check gateway: ip route
DNS: Inspect /etc/resolv.conf
Firewall: ufw status, iptables -L
Restart network: sudo systemctl restart NetworkManager or
ifup/ifdown
18. How to List Running Processes
Basic: ps aux or ps -ef
Tree view: ps auxf
Real-time: top
Enhanced view: htop (color-coded, sortable)
19. What is the chmod Command in Linux?
chmod changes file permissions.
Examples:
Symbolic: chmod u+x script.sh (give execute to user)
Numeric: chmod 755 script.sh (rwxr-xr-x)
20. How to Check Disk Space Usage
Overall: df -h
Directory level: du -sh /var/log
Interactive: ncdu (must be installed)
21. How do you find the PID of a running process?
pgrep nginx → directly returns the PID
ps aux | grep nginx → shows full process details
page 06
@JyotiSsahu
22. What is rsync and how is it used for synchronization?
rsync -avz --delete src/ dest/
-a: archive (preserves permissions)
-v: verbose
-z: compress
--delete: sync only what exists in source
23. How do you create a user account?
useradd devops_user && passwd devops_user
Or: adduser devops_user (more interactive)
24. How do you format a disk in Linux?
Identify: lsblk
Unmount: umount /dev/sdb1
Format: mkfs.ext4 /dev/sdb1
Mount: mount /dev/sdb1 /mnt/data
25. How do you change a user’s password?
passwd username
The system prompts for new and confirmation password.
26. Difference between a process and a thread?
Factor Process Thread
Independence Independent Dependent, share
Resource usage High Low
Performance Slower to create/terminate Faster
page 07
@JyotiSsahu
27. What is ulimit and how is it used?
ulimit -u 50 → limits user to 50 processes
Use ulimit -a to view current limits
Set in /etc/security/limits.conf for persistent configs
28. What is find and how is it used?
find /var/log -name "*.log"
Search by name, size, type, or modified time
Combine with exec to delete or archive files
29. What is RAID in Linux?
RAID Level Description
RAID 0 Striping — fast, no redundancy
RAID 1 Mirroring — redundancy, no speed boost
RAID 5 Striping + parity — balance of speed + safety
RAID 6 Like RAID 5, but with double parity
RAID 10 RAID 0 + RAID 1 — fast and redundant
30. Challenges of using Linux?
Driver & hardware compatibility (esp. laptops, GPUs)
Gaming support still behind Windows
Steep learning curve for beginners
Some firmware support is vendor-dependent
31. What is the /proc File System?
/proc is a virtual file system that exposes real-time kernel data and
process information as files. It’s used for:
Monitoring processes (/proc/<PID>)
Viewing system stats (/proc/meminfo, /proc/cpuinfo)
Tuning kernel parameters (/proc/sys/)
page 08
@JyotiSsahu
32. How Do You Secure a Linux Server?
Use key-based SSH with disabled password auth.
Apply security patches regularly.
Harden firewall rules using ufw or iptables.
Disable unused services.
Monitor logs (journalctl, /var/log/).
Enforce least-privilege access.
Use tools like Fail2Ban, AIDE, or SELinux/AppArmor.
Schedule regular backups and audits.
33. What Is strace?
strace traces system calls made by a process. It shows how programs
interact with the kernel — useful for:
Debugging crashes
Identifying missing files
Profiling behavior
Example: strace ls
34. How Do You Optimize Linux Performance?
Tune kernel parameters via sysctl.
Use tools: top, htop, iotop, vmstat, perf, pcp.
Disable unnecessary services.
Clean up disk usage (du, ncdu).
Use caching, compression, and swap wisely.
Monitor regularly and automate alerts.
35. How Do You Administer a Linux Server?
Manage users: adduser, usermod, passwd
Configure services: systemctl, firewalld, crontab
Monitor with tools like Prometheus, Nagios, or Zabbix
Apply backups and automate with tools like rsnapshot, BorgBackup
Secure access: SSH configs, firewall, intrusion detection
page 09
Keep recovery plans ready and tested
@JyotiSsahu
36. What Is Linux Virtual Memory?
Virtual memory allows Linux to use disk space as temporary RAM via
swap. It ensures processes don’t crash when physical RAM is full.
37. What Is Process Scheduling in Linux?
Linux uses a preemptive, priority-based scheduler. The kernel
dynamically assigns CPU time to processes based on:
Priority (static/dynamic)
CPU usage
Scheduling class (e.g., CFS)
38. Most Important Linux Commands
Some essential daily-use commands:
ls, cd, pwd, mkdir, rm
ps, top, htop, kill
grep, cat, less, tail -f
df, du, free
wget, curl
chmod, chown, man
39. What Is iptables and How Is It Used?
iptables configures the Netfilter firewall in Linux. It filters, redirects, or
blocks packets based on user-defined rules.
View rules: iptables -L
Add rule:
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
Make persistent:
iptables-save > /etc/iptables/rules.v4
🛡️ In DevOps: Use iptables or nftables in self-managed
environments. Cloud-native equivalents like AWS SGs work similarly.
page 10
@JyotiSsahu
40. How to Troubleshoot Linux Boot Failure
Read error messages on screen or from logs: journalctl -xb
Boot into recovery mode or a Live CD
Inspect GRUB configs: /etc/default/grub, /boot/grub/grub.cfg
Try older kernel versions
Check disk integrity: fsck
Undo recent system changes or check failed services
41. What is the init process in Linux?
The init process (PID 1) is the first user-space process that starts
during system boot. It brings the system to a usable state by initializing
services and system targets.
Modern Linux systems now use systemd — a faster, parallel, and
dependency-aware replacement for older SysVinit.
42. What is SMTP?
SMTP (Simple Mail Transfer Protocol) is a standard protocol used to
send emails between servers.
End-to-end model: For external communication
Store-and-forward model: Used within internal networks
43. What is LVM in Linux?
LVM (Logical Volume Manager) allows flexible and dynamic disk
management.
You can resize volumes, take snapshots, and manage storage without
unmounting or downtime.
page 11
@JyotiSsahu
44. Difference Between TCP and UDP
Feature TCP UDP
Type Connection-oriented Connectionless
Reliability Guaranteed delivery, ordered packets No delivery guarantees
Use Cases HTTP, FTP, SMTP, SSH DNS, VoIP, video streaming, games
45. What is /etc/resolv.conf?
This config file defines DNS servers used by the Linux system for
domain name resolution.
It contains:
nameserver: IP of DNS server
search: Domain suffix to auto-complete hostnames
46. Absolute vs Relative Paths in Linux
Type Description Example
Absolute Starts from root / /var/www/html/index.html
Relative Based on current directory ../scripts/run.sh
47. What is the grep command used for?
grep searches for patterns in files or output streams.
Example: grep "error" /var/log/syslog
48. How to Check the Status of a Service in Linux
Use systemctl (on systemd systems):
systemctl status nginx
page 12
@JyotiSsahu
49. Difference Between /etc/passwd and /etc/shadow
File Description Access
/etc/passwd Stores user info: UID, shell, home dir Readable
/etc/shadow Stores encrypted passwords + expiry settings Root-only
50. How to Compress and Decompress Files in Linux
Compress: tar -czvf backup.tar.gz myfolder/
Decompress: tar -xzvf backup.tar.gz
51. Difference Between a Process and a Daemon
A process is any running instance of a program. It can be
interactive (foreground) or background.
A daemon is a background process that starts at boot and runs
independently, typically with no terminal interaction. Example:
sshd, cron, nginx.
52. How to Schedule Recurring Tasks in Linux
Use the crontab -e command and define time-based jobs like:
30 3 * * * /path/to/geeks.sh
This runs daily at 3:30 AM.
🧠 DevOps Pro Tip: Always redirect logs in cron jobs to debug later:
/path/script.sh >> /var/log/script.log 2>&1
page 13
@JyotiSsahu
53. What is sed used for in Linux?
sed is a stream editor used to search, find, and replace text in files.
Example: sed 's/foo/bar/g' file.txt
Replaces all “foo” with “bar” in file.txt.
54. What Are Runlevels in Linux?
Runlevels represent system states:
0 – Halt
1 – Single-user mode
3 – Multi-user, no GUI
5 – Multi-user with GUI
6 – Reboot
Modern distros use systemd targets (graphical.target, multi-
user.target) as a replacement.
55. What is sudo in Linux?
sudo stands for Superuser Do. It allows permitted users to run
commands with elevated (root) privileges after password verification.
Example: sudo apt update
56. What is umask?
umask defines default permission restrictions for newly created
files/directories.
Example:
Default file permission: 666
umask 022 → actual permission = 644
🧠 In automation scripts, always validate file permissions by
checking umask.
page 14
@JyotiSsahu
57. How to Find and Kill a Process in Linux
1.Find the process: ps aux | grep nginx
2.Kill by PID: kill 1234
3.Kill by name: pkill nginx
🧠 DevOps Note: Use kill -9 only if graceful termination fails.
58. What is Network Bonding in Linux?
Network bonding combines multiple NICs into one virtual interface to:
Increase bandwidth (mode 0 – round robin)
Add redundancy (mode 1 – active-backup)
Configure via /etc/network/interfaces or nmcli.
🎯 Used in production servers and cloud VMs for high availability.
59. What is SELinux?
SELinux (Security-Enhanced Linux) enforces mandatory access
controls based on defined policies. It can run in:
Enforcing: applies rules
Permissive: logs violations
Disabled
⚠️ Warning: Incorrect settings can break apps. Use getenforce
and audit2allow for debugging.
60. What is SSH and How to Use It
SSH (Secure Shell) creates an encrypted connection to a remote
system: ssh user@ip_address
To harden SSH:
1.Use key-based authentication
2.Disable root login (PermitRootLogin no)
3.Change default port from 22
🔐 In DevOps: SSH is used daily for remote server access, CI/CD
runners, and infrastructure automation.
page 15
@JyotiSsahu
61. How do you check the contents of a file without
opening it in Linux?
Use the cat command: cat geeks.txt
Other useful commands:
head -n 10 geeks.txt → shows the first 10 lines
tail -n 10 geeks.txt → shows the last 10 lines
🎯 Tip: Use less or more for large files you want to scroll through
without editing.
62. What is the purpose of the crontab file in Linux?
crontab schedules recurring tasks using time expressions.
To run a script daily at 5 AM: crontab -e
Add: 0 5 * * * /path/to/jayesh.sh
🧠 In DevOps: Automate backups, health checks, or cleanup scripts
via cron.
63. How do you find and replace text using sed?
sed 's/true/False/g' file_name
This replaces all instances of “true” with “False”.
🎯 Use case: Replace environment variables or update configs inline
during deployments.
64. What is the purpose of the sudoers file?
It controls who can use sudo and which commands they’re allowed
to run.
Edit it safely with: sudo visudo
To give full access to jayesh: jayesh ALL=(ALL) ALL
🧠 Security Note: Always use visudo to prevent syntax errors that
could lock out sudo access.
page 16
@JyotiSsahu
65. How do you change file ownership using chown?
Syntax: chown jayesh:users file.txt
Changes owner to jayesh and group to users.
🔐 Tip: Use -R to change ownership recursively for directories.
66. What is the purpose of ping in Linux?
ping tests network connectivity by sending ICMP echo requests.
Example: ping 192.168.1.10
🎯reachability.
In DevOps: It’s your first step in debugging server or VM network
67. How to recursively copy files/directories using cp?
cp -R source_dir/ dest_dir/
-R: Recursively copies all files, subfolders, and contents.
🧠 In scripting: Ensure -R is used to avoid silent failures with folders.
68. What is netstat, and how do you view network info?
netstat -tuln → shows all listening TCP/UDP ports
-t: TCP
-u: UDP
-l: Listening
-n: Show numbers, not DNS names
🛠️ DevOps use: Check open ports, diagnose service bindings or
firewall blocks.
page 17
@JyotiSsahu
69. How to set a static IP in Linux from CLI?
Debian/Ubuntu-style: Edit /etc/network/interfaces:
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
Then: sudo systemctl restart networking
🧠 Note: Use nmcli or nmtui for NetworkManager-managed
systems (e.g., RHEL/CentOS 7+).
70. How to copy a file to multiple directories in Linux?
Using a loop: for dir in /dir1 /dir2 /dir3; do cp file.txt "$dir"; done
Using find + xargs: find /dirs -type d -name "target*" | xargs -I {} cp
file.txt {}
🎯 Real-world use: Deploying scripts/configs to multiple container
volumes or test environments.
71. How Are Files Organized in Linux?
Linux uses a hierarchical file system, starting from the root
directory /. Everything — including devices, users, and system files
— branches from this root:
/bin – essential binaries
/etc – config files
/home – user directories
/var – logs, spool
/dev – device files
🎯 In DevOps: Knowing this helps you debug config paths, script
automation, and troubleshoot services.
page 18
@JyotiSsahu
72. How to Find the IP Address of a Linux System
ip a
Or legacy: ifconfig
🧠 Pro Tip: Use hostname -I for just the IP address (good for
scripts).
73. Hard Link vs Symbolic Link
Feature Hard Link Symbolic Link
Points to File's data (inode) File path
Breaks if file deleted? No Yes (broken link)
Can link dirs? No Yes
Inode Same as original Different
🎯HardUselinksCase: Symbolic links are flexible for config management.
are faster, but less used.
74. How to Check Disk Space in Linux
df -h
Shows used/available disk space in human-readable format.
🧠specific
DevOps Tip: Use du -sh /path to check space used by a
directory.
75. How to Start and Stop a Service in Linux
sudo systemctl start nginx
sudo systemctl stop nginx
🔁
page 19
Also useful: restart, enable, disable, status subcommands.
@JyotiSsahu
76. Common Causes of File Permission Issues
Wrong ownership (chown)
Incorrect permissions (chmod)
umask set too restrictively
Missing execute (x) permission on scripts
SELinux or AppArmor restrictions
🎯 DevOps Reality: Misconfigured permissions break
deployments and cause build failures. Always check with ls -l.
77. How to Troubleshoot Network Connectivity in
Linux
ping the remote server
Check IP & routing: ip a, ip route
Check DNS: cat /etc/resolv.conf
View firewall: ufw status or iptables -L
Check logs: /var/log/syslog or dmesg
🧠 Use tools like traceroute, curl, or nc to go deeper.
78. Steps to Fix Network Connectivity Issues
1.Check cables or virtual NIC status
2.Verify IP config: ip a, nmcli, /etc/netplan/ or
/etc/network/interfaces
3.Test DNS with dig, nslookup
4.View firewall rules: iptables, firewalld
5.Use:
ping – check reachability
traceroute – trace route to host
tcpdump – analyze traffic
🎯 In DevOps: Automate checks using healthcheck scripts in
cron or monitoring agents.
page 20
@JyotiSsahu
79. How to Check System Logs in Linux
Most logs are stored in /var/log/
Common logs:
/var/log/syslog or /var/log/messages – system-wide
logs
/var/log/auth.log – login/authentication
/var/log/dmesg – kernel messages
Commands:
tail -f /var/log/syslog
less /var/log/auth.log
🧠logs.Pro Tip: Use journalctl on systemd systems for detailed service
80. Why Would a Linux System Run Out of Memory?
Master Answer:
Memory leaks in long-running apps
Misconfigured processes consuming excessive RAM
High memory demand (large databases, builds)
Lack of swap space
Zombie processes or runaway scripts
Use:
top, htop to identify memory hogs
free -m for RAM/swap usage
vmstat for memory pressure
🎯OOMDevOps Pro Tip: Always have alerts on memory usage and
events.
page 21
@JyotiSsahu
81. How Would You Troubleshoot a Slow-Performing
Linux Server?
Start with system metrics:
Use top, htop, iotop, vmstat to find CPU, memory, or disk I/O
bottlenecks
Check disk space: df -h, du -sh /var/*
Review logs: /var/log/syslog, dmesg, app-specific logs
Check running services: systemctl, ps aux, and memory/cpu-
heavy apps
Analyze network latency: ping, netstat, ss
🧠timeProinsight.
Tip: Set up monitoring with Prometheus + Grafana for real-
82. What Are Common Causes of Disk Space Issues in
Linux?
Log files growing unchecked (/var/log)
Old backups or cached data
Temp files in /tmp, /var/tmp
Containers or images (Docker volumes)
Failed rm operations (deleted files still held by processes)
Use:
du -sh /*
lsof | grep deleted
🎯prevent
In DevOps: Set up log rotation (logrotate) and alerting to
outages.
page 22
@JyotiSsahu
83. How to Identify and Kill High CPU Usage
Process in Linux?
top
or
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
To kill: kill -9 <PID>
🧠 Tip: Avoid kill -9 unless necessary. Start with kill -15
(graceful shutdown).
84. How to Troubleshoot a Linux System That Won’t Boot
1.Check boot error messages
2.Use GRUB to boot into an older kernel or recovery mode
3.Boot via a Live CD and inspect:
/etc/fstab for disk mount issues
Filesystem health: fsck
4. Review logs: /var/log/boot.log, journalctl -xb
🧠 Pro Tip: Maintain bootable rescue media and regular config
snapshots.
85. What Does ifconfig Do?
Displays or configures network interfaces — shows IP
addresses, MAC addresses, and status.
Example: ifconfig eth0
🔄is deprecated
Modern Replacement: Use ip a or ip addr show — ifconfig
in some distros.
page 23
@JyotiSsahu
86. How to Set a Static IP in Linux
Edit /etc/network/interfaces or /etc/netplan/:
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
Then restart networking: sudo systemctl restart networking
🧠 RedHat-based:
scripts/ifcfg-eth0
Use /etc/sysconfig/network-
87. How to Configure a DNS Server in Linux
Edit /etc/named.conf — define zones
Add zone files in /var/named/
Set forwarders and options
Start BIND: systemctl start named
🧠 In DevOps: Internal DNS servers often resolve cluster or
service domain names.
88. What Is a Firewall in Linux and How Do You Set It Up?
A firewall filters inbound and outbound network traffic based
on rules.
Set rules with:
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -j DROP
Or use modern:
nftables
Simple distros: ufw or firewalld
🎯 Use in production: Restrict access by IP, port, and protocol.
page 24
Always backup firewall configs.
@JyotiSsahu
89. How to Check Network Connectivity Between Two
Linux Systems
Use: ping <remote_host>
traceroute <remote_host>
nc -zv <host> <port>
🧠 Pro Tip: telnet, curl, and ss can test service-level connectivity.
90. What Is the Purpose of the route Command?
route displays or modifies the kernel's IP routing table.
View routes: route -n
Add a route: route add -net 10.0.0.0/24 gw 192.168.1.1
🔁 Modern Replacement: Use ip route instead of route.
91. How Do You Configure a Linux System to Act as a Router?
To turn a Linux machine into a router:
1.Enable IP forwarding:
echo 1 > /proc/sys/net/ipv4/ip_forward
Or make it persistent by editing /etc/sysctl.conf:
net.ipv4.ip_forward = 1
Then reload:
sysctl -p
2. Set up NAT (if routing between private and public networks):
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
3. Configure routing tables if needed:
ip route add <destination> via <gateway> dev <interface>
🎯building
Use Case: This setup is often used in labs, gateways, or when
internal Kubernetes or Docker networking layers.
page 25
@JyotiSsahu
Thank You for
Reading
“You don’t need
to memorize
Linux. You need to
understand how it
thinks.”
— Jyoti Sahu
page 26
@JyotiSsahu