Top 25 Linux Interview Questions and Answers for Freshers in 2026
Linux is one of the most widely used operating systems for servers, cloud infrastructure, application hosting, automation, and container platforms. Many organizations use Linux to run web applications, databases, CI/CD pipelines, and production workloads.
If you are preparing for a DevOps Engineer, Cloud Engineer, Linux Administrator, System Administrator, or Technical Support interview, Linux fundamentals are essential.
In this Expectin guide, we cover 25 common Linux interview questions and answers, with practical commands and troubleshooting examples to help you prepare for your next opportunity.
1. What Is Linux?
Linux is an open-source operating system kernel. Operating systems built around the Linux kernel are commonly called Linux distributions.
Popular distributions include Ubuntu, Debian, Fedora, Red Hat Enterprise Linux, and Amazon Linux.
Linux is widely used for:
Web and application servers
Cloud infrastructure
Container platforms
Database servers
Automation and scripting
Networking and security tools
Development and testing environments
Its flexibility, automation capabilities, and extensive command-line tools make Linux valuable for many IT careers.
2. What Is the Difference Between Linux and Unix?
Unix refers to a family of operating systems and related standards. Linux is a Unix-like operating system kernel created as an open-source project.
Both support concepts such as files, processes, permissions, shells, and command-line administration.
However, Linux and traditional Unix systems differ in their implementations, licensing, distributions, and supported tools.
Linux distributions are commonly used for cloud servers, containers, and modern application infrastructure.
3. What Is a Linux Shell?
A shell is a program that accepts commands and runs programs or scripts.
Common shells include:
Bash
Zsh
Dash
Fish
Bash is widely used for Linux administration and shell scripting.
Example:
echo "Welcome to Expectin"
pwd
whoamiThese commands print a message, display the current working directory, and show the current username.
4. What Are Commonly Used Linux Commands?
Some important commands for beginners include:
| Command | Purpose |
|---|---|
pwd | Display the current directory |
ls | List files and directories |
cd | Change directories |
mkdir | Create a directory |
touch | Create an empty file or update timestamps |
cp | Copy files and directories |
mv | Move or rename files |
rm | Remove files or directories |
cat | Display file contents |
less | View file contents interactively |
grep | Search text patterns |
find | Find files and directories |
Example:
mkdir practice
cd practice
touch example.txt
ls -lThis creates a directory, enters it, creates a file, and lists its contents.
Be careful with destructive commands such as rm. Always verify the target path before deleting files.
5. What Is the Difference Between Absolute and Relative Paths?
An absolute path specifies a location from the filesystem root.
Example:
/home/user/documents/report.txtA relative path specifies a location from the current working directory.
Example:
documents/report.txtThe . symbol refers to the current directory, while .. refers to the parent directory.
Understanding paths is important when managing files, configuring applications, and writing scripts.
6. What Are Linux File Permissions?
Linux permissions control who can read, write, or execute a file or directory.
There are three main permission categories:
User: The file owner
Group: Members of the file's group
Others: Other users
The basic permission symbols are:
r— readw— writex— execute
Use the following command to inspect permissions:
ls -lExample output:
-rwxr-xr-- 1 user developers 1200 Oct 28 script.shThis indicates read, write, and execute permissions for the owner; read and execute permissions for the group; and read permission for others.
7. What Is the Difference Between chmod and chown?
chmod changes file permissions.
chown changes file ownership and, optionally, group ownership.
Examples:
chmod 755 script.shThis gives the owner read, write, and execute permissions, while the group and others receive read and execute permissions.
sudo chown user:developers script.shThis changes the file owner and group to the specified values, assuming those accounts exist and the caller has sufficient privileges.
Avoid granting broad permissions such as 777 unless there is a clearly justified need.
8. What Is the Difference Between Hard Links and Symbolic Links?
A hard link is another directory entry referring to the same underlying file data.
A symbolic link is a separate filesystem object that points to a pathname.
Create a symbolic link with:
ln -s /var/log/application.log app-log-linkSymbolic links can point to directories and paths on other mounted filesystems. Hard links generally cannot cross filesystem boundaries and ordinarily cannot be created for directories by regular users.
A symbolic link may become broken if its target path is removed or moved.
9. How Do You Check Disk Space in Linux?
The df command displays filesystem space usage.
Example:
df -hThe -h option displays sizes in human-readable units.
To check how much space a directory uses, run:
du -sh /var/logTo identify large files or directories, inspect the relevant paths using commands such as du and find.
For production systems, check both filesystem capacity and inode usage because a filesystem can run out of inodes even when some storage space remains.
10. How Do You Check Memory Usage in Linux?
Useful commands include:
free -htopvmstat 1free -h summarizes memory and swap usage. top displays running processes and resource utilization. vmstat provides system-level statistics.
Linux uses available memory for caching, so low-looking free memory does not automatically mean the system is out of memory. Review available memory, swap activity, application behavior, and relevant system logs.
11. How Do You Check CPU Usage?
You can use:
topor:
ps aux --sort=-%cpu | headThese commands help identify processes consuming CPU resources.
If CPU usage is consistently high, investigate the affected process, workload, recent changes, and application logs.
High CPU usage can result from legitimate traffic, inefficient code, background jobs, or unexpected processes. Avoid terminating processes until you understand their purpose and impact.
12. What Is a Linux Process?
A process is a running instance of a program.
Each process has a process ID (PID), which identifies it within the operating system.
Useful commands include:
ps auxpgrep nginxtopps displays process information, pgrep searches for processes by name or pattern, and top provides a live view of system activity.
13. What Is the Difference Between a Process and a Thread?
A process is an executing program with its own process-level resources and address space.
A thread is an execution unit within a process. Threads within the same process generally share the process's memory and other resources while maintaining their own execution state.
Applications use threads for concurrency, responsiveness, and parallel work.
A problem in one thread can affect the entire process, depending on the failure and application design.
14. How Do You Stop a Process in Linux?
The kill command sends a signal to a process.
Example:
kill 1234This requests termination using the default SIGTERM signal.
If a process does not stop and you have confirmed it is safe to terminate, you may use:
kill -9 1234SIGKILL forces the process to terminate and does not allow it to perform normal cleanup.
Prefer graceful termination first, particularly for databases, production services, and applications handling important work.
15. What Is a Linux Service?
A service is a background application or system component that provides functionality such as web hosting, logging, scheduling, or networking.
Many modern Linux distributions use systemd to manage services.
Common commands include:
systemctl status nginxsudo systemctl start nginxsudo systemctl restart nginxsudo systemctl enable nginxstatus checks service state, start starts a service, restart restarts it, and enable configures it to start automatically according to its unit settings.
Service names and management tools can vary between Linux distributions.
16. How Do You Check Linux Logs?
Linux logs help administrators understand system events, application failures, authentication activity, and service behavior.
Common locations and tools include:
/var/log/journalctlApplication-specific log files
System and authentication logs, depending on the distribution
Examples:
journalctl -u nginx --since "1 hour ago"journalctl -p err -btail -n 100 /var/log/syslogThe final example applies to systems that use /var/log/syslog; other distributions may store system messages elsewhere.
When troubleshooting, check timestamps, error messages, recent deployments, and whether the relevant service is writing to the expected log destination.
17. What Is SSH in Linux?
SSH stands for Secure Shell. It provides an encrypted connection for remote administration and other supported operations.
Example:
ssh username@server-ipSSH is commonly used to access cloud instances and Linux servers.
Security best practices include:
Using key-based authentication where appropriate
Protecting private keys
Restricting access to authorized users
Using appropriate firewall rules
Avoiding unnecessary public exposure
Monitoring authentication failures
On cloud servers, access controls should align with the environment's security policies.
18. How Do You Check Network Connectivity in Linux?
Common network troubleshooting commands include:
ip addrip routeping example.comcurl -I https://example.comip addr displays network interfaces and addresses. ip route displays routing information. ping tests ICMP reachability where permitted, and curl can test HTTP or HTTPS connectivity.
A failed ping does not necessarily mean a server is unavailable because ICMP traffic may be blocked.
For deeper troubleshooting, check DNS resolution, routes, firewall rules, listening ports, and application logs.
19. What Is DNS?
The Domain Name System (DNS) maps domain names to information such as IP addresses and other service records.
Linux systems use DNS to resolve names such as example.com into network addresses.
Useful commands include:
getent hosts example.comdig example.comThe dig command is available when the appropriate DNS utilities package is installed.
DNS troubleshooting should consider resolver configuration, caching, record values, and network connectivity to DNS servers.
20. What Is a Port in Linux Networking?
A port identifies a communication endpoint associated with a transport protocol such as TCP or UDP.
Common examples include:
SSH — TCP port 22 by default
HTTP — TCP port 80 by default
HTTPS — TCP port 443 by default
To inspect listening sockets, use:
ss -tulpnSome process details may require elevated privileges.
A service can be running but unreachable because of firewall rules, incorrect bind addresses, routing problems, or external network restrictions.
21. What Is a Shell Script?
A shell script is a file containing commands executed by a shell.
Scripts are commonly used for automation, backups, system checks, deployments, and routine administration.
Example:
#!/usr/bin/env bash
echo "Starting system check"
date
df -h
free -h
echo "System check completed"Save the script as system-check.sh, then run:
chmod +x system-check.sh
./system-check.shShell scripts should handle errors carefully, quote variables appropriately, and avoid exposing sensitive information.
22. What Is Cron in Linux?
Cron is a scheduling system used to run commands or scripts at specified times.
A crontab entry commonly contains five time fields followed by a command.
Example:
0 2 * * * /home/user/backup.shThis schedules the script to run daily at 02:00 according to the cron environment's configured time zone.
Common uses include scheduled backups, cleanup jobs, report generation, and maintenance tasks.
Before deploying scheduled jobs, verify the execution user, environment variables, permissions, logging, and failure notifications.
23. What Is the Difference Between apt and yum or dnf?
Package managers install, update, and remove software.
aptis commonly used on Debian and Ubuntu systems.dnfis used on modern Fedora and some related distributions.yumis associated with older Red Hat-family systems and may also be available as a compatibility command.
Examples:
sudo apt update
sudo apt install nginxOn a distribution that uses DNF:
sudo dnf install nginxUse the package manager appropriate to the operating system. Package names, repositories, permissions, and installation commands may differ between distributions.
24. How Do You Troubleshoot a Linux Server That Is Running Slowly?
Start by gathering evidence before changing the system.
Useful commands include:
uptimetopfree -hdf -hiostat -xz 1The iostat command requires the appropriate system utilities to be installed.
Investigate:
CPU saturation
Memory pressure and swap usage
Disk capacity and storage latency
Network delays or errors
High resource usage by individual processes
Application and system logs
Recent deployments or configuration changes
A slow server can have multiple contributing causes. Compare current metrics with normal operating behavior and make changes only after identifying a likely root cause.
25. What Is the Difference Between Root and a Normal User?
The root account has extensive administrative privileges over the system.
A normal user has permissions defined by ownership, groups, access controls, and other security policies.
Administrators often use sudo to execute specific commands with elevated privileges.
Example:
sudo systemctl restart nginxUsing a normal account for everyday work and elevating privileges only when required helps reduce the risk of accidental or unauthorized changes.
Do not run every application as root unless there is a specific, justified requirement.
Practical Linux Projects for Beginners
Hands-on practice helps you build confidence and develop troubleshooting skills.
Project 1: Linux System Information Script
Write a shell script that reports the current date, hostname, disk usage, memory usage, and uptime.
Practise running the script, handling permissions, and redirecting output to a file.
Project 2: Configure a Web Server
Install NGINX on a Linux virtual machine, verify the service status, and test the HTTP endpoint.
Learn how to inspect service logs and troubleshoot port or configuration problems.
Project 3: Set Up a Scheduled Backup
Create a small backup script and schedule it using cron in a test environment.
Include timestamped logs and verify that the backup output can be restored.
Project 4: Practise User and Permission Management
Create a test user and group, configure directory permissions, and verify access with the appropriate commands.
Learn how ownership and permission settings affect application behavior.
Project 5: Troubleshoot a Test Server
Use a virtual machine to practise investigating a failed service, a full filesystem, a port conflict, or a DNS problem.
Document the evidence, root cause, fix, and validation steps.
Always use a test environment for destructive exercises and protect any important data.
Linux Interview Preparation Tips
Practise commands regularly
Work with files, directories, processes, permissions, services, logs, and network troubleshooting.
Understand permissions
Be comfortable reading ls -l output and explaining the difference between chmod, chown, and sudo.
Learn networking fundamentals
Study IP addresses, DNS, routes, ports, TCP, and basic firewall concepts.
Learn shell scripting
Practise variables, conditions, loops, functions, exit codes, and safe handling of command failures.
Prepare troubleshooting examples
Explain how you would investigate high CPU usage, memory pressure, a failed service, low disk space, or an unreachable application.
Connect Linux with cloud and DevOps
Learn how Linux supports Docker, Kubernetes, CI/CD pipelines, cloud virtual machines, monitoring, and Infrastructure as Code.
Find Linux and DevOps Jobs on Expectin
Linux knowledge can support several career paths, including:
Linux Administrator
System Administrator
Cloud Support Engineer
DevOps Engineer
Cloud Engineer
Site Reliability Engineer
Infrastructure Engineer
Technical Support Engineer
Requirements vary by employer. Entry-level positions may focus on commands, permissions, and basic troubleshooting, while advanced roles may require shell scripting, automation, cloud platforms, security, and production incident management.
Visit https://expectin.com to explore available job opportunities and review the experience requirements, technical skills, location, and application instructions for each vacancy.
Frequently Asked Questions
Is Linux suitable for freshers?
Yes. Linux fundamentals are useful for freshers interested in system administration, cloud support, DevOps, and infrastructure roles.
Which Linux distribution should beginners learn?
Ubuntu is a common starting point because it is accessible and widely documented. Learning the fundamentals also helps you work with other distributions.
Is Linux required for DevOps jobs?
Linux is important for many DevOps roles because it supports servers, containers, scripting, and troubleshooting. The required depth depends on the employer and role.
Should I learn Linux commands or shell scripting first?
Start with basic commands, files, permissions, processes, and services. Then learn shell scripting to automate routine tasks.
How can I practise Linux safely?
Use a virtual machine, an isolated cloud instance, or a suitable local Linux environment. Practise destructive commands only on test data and avoid changing production systems while learning.
Where can I find Linux-related jobs?
Visit https://expectin.com to explore current vacancies and check the skills and experience required for each position.
About Expectin
Expectin helps job seekers explore career opportunities and access career-related resources. Keep practising Linux, develop troubleshooting skills, and take the next step in your IT career.
