Linux Fundamentals - Complete Interview Guide for DevOps Engineers

Master Linux fundamentals including architecture, filesystem, shell, commands, users, permissions, processes, networking, package management, and production examples for DevOps and Software Engineering interviews.

Introduction

Linux is the world's most widely used operating system for servers, cloud computing, DevOps, containers, and enterprise applications.

Almost every cloud platform—including AWS, Azure, Google Cloud, Kubernetes, Docker, OpenShift, and most enterprise Java applications—runs on Linux.

Whether you're preparing for interviews or working in production support, Linux knowledge is one of the most valuable technical skills.

In this guide you'll learn:

  • Linux architecture
  • Linux distributions
  • Filesystem hierarchy
  • Shell basics
  • Essential commands
  • File management
  • Users and groups
  • Permissions
  • Processes
  • Networking
  • Package management
  • Archive utilities
  • Production best practices

Why Learn Linux?

Linux powers:

  • AWS EC2
  • Azure Virtual Machines
  • Google Cloud Compute Engine
  • Docker Containers
  • Kubernetes Nodes
  • OpenShift Clusters
  • Web Servers
  • Databases
  • Enterprise Java Applications

Nearly every DevOps, Cloud, Platform Engineering, SRE, and Backend Engineer interview includes Linux questions.


What is Linux?

Linux is an open-source Unix-like operating system kernel originally created by Linus Torvalds in 1991.

A complete Linux operating system consists of:

  • Kernel
  • Shell
  • System Libraries
  • Utilities
  • Applications
        User
          │
          ▼
     Applications
          │
          ▼
        Shell
          │
          ▼
        Kernel
          │
          ▼
      Hardware

Linux Architecture

1. Hardware

Physical resources

  • CPU
  • Memory
  • Disk
  • Network
  • USB Devices

2. Kernel

The kernel is the heart of Linux.

Responsibilities

  • Memory Management
  • Process Scheduling
  • Device Drivers
  • Networking
  • File System Management
  • Security

Without the kernel, Linux cannot function.


3. Shell

The shell acts as an interpreter between the user and the kernel.

Popular shells:

  • Bash
  • Zsh
  • Ksh
  • Fish

Example:

ls -l

The shell converts your command into system calls that the kernel executes.


4. Applications

Applications include:

  • Java
  • Python
  • MySQL
  • Nginx
  • Apache
  • Docker
  • Kubernetes

Linux Distributions

A Linux distribution packages the Linux kernel with tools, package managers, and utilities.

Popular distributions:

Distribution Usage
Ubuntu Development, Cloud
Debian Stable Servers
RHEL Enterprise
Rocky Linux Enterprise Replacement
AlmaLinux Enterprise Replacement
CentOS Stream Development
Fedora Latest Features
SUSE Enterprise
Amazon Linux AWS EC2

Linux File System

Everything in Linux is treated as a file.

/
├── bin
├── boot
├── dev
├── etc
├── home
├── lib
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin
├── srv
├── sys
├── tmp
├── usr
└── var

Important Directories

/

Root directory.

Every directory starts here.


/home

Stores user home directories.

Example

/home/venu
/home/john

/root

Home directory of the root user.


/etc

Stores system configuration files.

Examples

/etc/passwd
/etc/group
/etc/hosts
/etc/fstab

/bin

Essential executable commands.

Examples

ls
cp
mv
cat
mkdir

/usr

User programs and libraries.


/var

Variable files.

Examples

  • Logs
  • Cache
  • Mail
  • Database files

/tmp

Temporary files.

Often cleared during reboot.


/boot

Kernel and bootloader files.


/dev

Device files.

Examples

/dev/sda
/dev/null
/dev/random

/proc

Virtual filesystem containing kernel and process information.

Example

cat /proc/cpuinfo

Absolute vs Relative Path

Absolute path starts from root.

Example

/home/venu/projects

Relative path starts from current directory.

Example

projects/java

Basic Navigation Commands

pwd

Print current directory.

pwd

Output

/home/venu

ls

List files.

ls

Detailed listing

ls -l

Hidden files

ls -la

Human-readable

ls -lh

cd

Change directory.

cd Documents

Home directory

cd

Previous directory

cd -

Parent directory

cd ..

Creating Files

touch

touch file.txt

Create multiple files

touch a.txt b.txt c.txt

mkdir

Create directory

mkdir project

Nested directories

mkdir -p java/spring/security

Removing Files

Delete file

rm file.txt

Delete directory

rm -r folder

Force delete

rm -rf folder

⚠️ Never execute rm -rf /.


Copy Files

cp source.txt destination.txt

Copy directory

cp -r project backup

Move Files

mv old.txt new.txt

Move file

mv file.txt /tmp

View File Contents

cat

cat file.txt

less

less file.txt

Allows scrolling.


head file.txt

First 10 lines.


tail

tail file.txt

Monitor logs

tail -f application.log

Search Commands

find

Find by name

find . -name "*.java"

Find directories

find . -type d

locate

locate application.properties

grep

Search text

grep "ERROR" application.log

Ignore case

grep -i error log.txt

Recursive

grep -r "spring" .

File Permissions

-rwxr-xr--

Breakdown

Owner
Group
Others

Permission values

Permission Value
Read 4
Write 2
Execute 1

Examples

755
644
600
777

Change permissions

chmod 755 app.sh

Change Ownership

chown venu file.txt

Change group

chgrp developers file.txt

Users

Current user

whoami

Current login

who

User ID

id

User Management

Create user

sudo useradd developer

Set password

sudo passwd developer

Delete user

sudo userdel developer

Groups

Create group

sudo groupadd backend

Add user

sudo usermod -aG backend developer

Environment Variables

Display

env

Echo

echo $PATH

Create variable

export JAVA_HOME=/opt/java

Processes

View running processes

ps -ef

Interactive view

top

Modern alternative

htop

Kill process

kill PID

Force kill

kill -9 PID

Networking Commands

Show IP

ip addr

Routing

ip route

Ping

ping google.com

DNS lookup

nslookup google.com

Open ports

ss -tulnp

Disk Usage

Filesystem usage

df -h

Directory size

du -sh *

Memory

free -h

CPU Information

lscpu

Package Management

Ubuntu

sudo apt update
sudo apt install nginx

RHEL / Rocky / Alma

sudo dnf install nginx

Older systems

sudo yum install nginx

Archive Commands

Create tar

tar -cvf app.tar project

Extract

tar -xvf app.tar

Gzip

gzip app.log

Unzip

unzip files.zip

Download Files

Using wget

wget https://example.com/file.zip

Using curl

curl -O https://example.com/file.zip

Redirection

Overwrite

echo "Hello" > file.txt

Append

echo "World" >> file.txt

Pipe

cat log.txt | grep ERROR

Useful Keyboard Shortcuts

Shortcut Purpose
Ctrl + C Stop process
Ctrl + Z Suspend process
Ctrl + D Logout
Ctrl + L Clear terminal
Ctrl + R Search history
Tab Auto-complete
Previous command

Production Example

A Java application is not responding.

Recommended troubleshooting order:

  1. Check process
ps -ef | grep java
  1. Check CPU
top
  1. Check memory
free -h
  1. Check disk
df -h
  1. Check logs
tail -f application.log
  1. Verify listening ports
ss -tulnp

Common Interview Questions

What is Linux?

Linux is an open-source Unix-like operating system based on the Linux kernel.


What is the kernel?

The kernel manages hardware resources and acts as the bridge between applications and hardware.


What is the shell?

The shell is a command interpreter that allows users to interact with the operating system.


What is the difference between absolute and relative paths?

Absolute paths start from /.

Relative paths start from the current working directory.


What is the difference between > and >>?

> overwrites a file.

>> appends to a file.


What is the difference between cp and mv?

cp copies files.

mv moves or renames files.


How do you check disk usage?

df -h

How do you search for a file?

find . -name filename

How do you search inside a file?

grep "text" filename

How do you check running processes?

ps -ef
top

Best Practices

  • Never work as the root user unless necessary.
  • Follow the principle of least privilege.
  • Avoid using chmod 777.
  • Regularly monitor disk space.
  • Keep software packages updated.
  • Rotate logs periodically.
  • Use SSH keys instead of passwords.
  • Understand filesystem hierarchy before making system changes.
  • Learn common troubleshooting commands by heart.

Summary

In this chapter, you learned:

  • Linux architecture
  • Kernel and shell
  • Linux distributions
  • Filesystem hierarchy
  • Essential Linux commands
  • Users and groups
  • Permissions
  • Process management
  • Networking basics
  • Package management
  • Archive utilities
  • Production troubleshooting

These concepts form the foundation required for DevOps, Cloud Engineering, SRE, Platform Engineering, and Software Development interviews.