60+ Most Asked Linux Interview Questions (2027)
62 most asked Linux interview questions with short answers for freshers: kernel, filesystem, permissions, processes, systemctl, networking on RHEL 10.
The most asked Linux interview questions check whether you know the basics without looking them up: what the kernel and shell do, how the filesystem is laid out, how permissions and users work, how to find and kill processes, and which commands you use to read logs, check disk space and test the network. This page has 62 short answers, written mainly for freshers and early-career candidates, with the commands checked on RHEL 10.
If you already work as a Linux administrator, the deeper material (LVM, SELinux troubleshooting, boot recovery) is in our 150+ Linux system administration interview questions. For hands-on problem solving, read the scenario-based Linux interview questions. This page stays with the definitions and everyday commands that first-round interviewers ask about most often.
Key takeaways
- Fresher rounds focus on concepts you can explain in two sentences: kernel, shell, filesystem hierarchy, inodes, links, permissions, processes and services.
- Interviewers expect current tools. On RHEL 10 that means
ip,ssandnmclifor networking,systemctlandjournalctlfor services and logs, anddnffor packages. - Know the numbers by heart: octal permissions (755, 644), signal 9 versus 15, and the standard file descriptors 0, 1 and 2.
- Practise each command on a real machine. Many first rounds now include a live terminal task.
- For each answer, give the definition first and then one command that shows it.
Quick reference: commands that come up in almost every interview
| Task | Command (RHEL 10) | Older or legacy equivalent |
|---|---|---|
| Show IP addresses | ip addr | ifconfig (net-tools, deprecated) |
| List listening ports | ss -tulpn | netstat -tulpn |
| Manage a service | systemctl status|start|enable sshd | service sshd start |
| Read logs | journalctl -u sshd | /var/log/messages |
| Install a package | dnf install httpd | yum install httpd (now an alias for dnf) |
| Disk usage | df -h, du -sh dir | same |
| Running processes | ps aux, top | same |
| Configure network | nmcli, nmtui | ifcfg files (removed from RHEL 10) |
Linux interview questions for freshers
1. What is Linux?
Linux is the kernel at the centre of a family of open source, Unix-like operating systems. People often say "Linux" to mean a full distribution: the Linux kernel plus GNU tools, a package manager, an init system and applications. Linus Torvalds released the first kernel in 1991.
2. What is the difference between Linux and a Linux distribution?
The Linux kernel is one component. A distribution such as RHEL, Fedora, Debian or Ubuntu packages that kernel with libraries, utilities, an installer, a package manager and default settings, and provides updates and support for it.
3. What does the kernel do?
The kernel manages the CPU, memory, devices and processes. It schedules processes, handles system calls, loads drivers and enforces permissions. Programs never touch hardware directly; they ask the kernel through system calls. Check the running kernel with uname -r.
4. What is a shell?
A shell is the program that reads your commands and asks the kernel to run them. Bash is the default on RHEL; others include zsh, sh (dash on Debian) and fish. echo $SHELL shows your login shell.
5. What is the difference between a terminal and a shell?
The terminal (or terminal emulator) is the window that displays text and passes keystrokes. The shell runs inside it and interprets what you type.
6. Explain the Linux filesystem hierarchy.
Everything sits under one root, /. Common directories:
/etc: system configuration files/home: user home directories;/rootis the root user's home/var: variable data such as logs, spools and caches/usr: installed programs and libraries; on RHEL,/binand/sbinare symlinks into/usr/tmp: temporary files/dev,/proc,/sys: device files and kernel interfaces/boot: kernel and bootloader files
The layout follows the Filesystem Hierarchy Standard, with distribution-specific changes.
7. What is the difference between an absolute and a relative path?
An absolute path starts at /, for example /etc/ssh/sshd_config. A relative path starts from the current directory, for example ../logs/app.log. pwd prints where you are.
8. What is root?
Root is the superuser with UID 0. It can read any file and change any setting. Day to day, administrators log in as a normal user and run privileged commands with sudo, which logs each use.
9. What is an inode?
An inode is a data structure that stores a file's metadata: owner, group, permissions, size, timestamps and the location of its data blocks. It does not store the file name; directory entries map names to inode numbers. ls -i shows inode numbers, and df -i shows inode usage.
10. What is the difference between a hard link and a soft link?
A hard link is another directory entry pointing to the same inode, so it keeps working if the original name is deleted. It cannot cross filesystems or point to directories. A soft (symbolic) link stores a path to the target; it can cross filesystems but breaks if the target moves.
ln file.txt hard.txt
ln -s /etc/hosts hosts-link
11. How do Linux file permissions work?
Every file has read (r), write (w) and execute (x) permissions for three classes: the owner (user), the group and others. ls -l shows them as a string such as -rwxr-xr--. On a directory, x means you can enter it and r means you can list it.
12. What do the numbers in chmod 755 mean?
Each digit is the sum of r=4, w=2 and x=1 for user, group and others. 755 is rwxr-xr-x: the owner has full access and everyone else can read and execute. 644 is rw-r--r--, the usual mode for a plain file.
13. What does chown do?
chown changes a file's owner and group, for example chown alice:developers report.txt. Use -R to apply it to a directory tree. Only root can give a file to another user.
14. What is umask?
umask removes permission bits from newly created files and directories. With umask 022, new files get 644 and new directories get 755. Run umask to see the current value.
15. Which commands do you use to create, copy, move and delete files?
touch creates an empty file, mkdir -p creates directories, cp copies (-r for directories), mv moves or renames, and rm deletes (rm -r for directories). There is no recycle bin on the command line, so check before you run rm -rf.
16. How do you view the contents of a file?
cat prints the whole file, less pages through it, head -n 20 and tail -n 20 show the start or end, and tail -f follows a growing log.
17. How do you search for text inside files?
Use grep. grep -i error app.log ignores case, -r searches a directory, -n shows line numbers and -v shows lines that do not match.
18. How do you find files?
find searches the filesystem live, for example find /var/log -name "*.log" -mtime -1. locate is faster but reads a database that updatedb refreshes, so it can miss new files. On RHEL, locate comes from the plocate package.
19. What is a process, and what is a PID?
A process is a running instance of a program. The kernel gives each one a unique process ID (PID). PID 1 on RHEL is systemd, the parent of all other processes. Each process also has a parent PID (PPID).
20. How do you list processes?
ps aux shows every process with its user, CPU and memory use. ps -ef shows the parent PID. top (or htop, if installed) updates the view live. pgrep nginx returns the PIDs of matching processes.
21. What is the difference between kill -15 and kill -9?
Signal 15 (SIGTERM) asks the process to exit and lets it clean up. It is the default for kill. Signal 9 (SIGKILL) is handled by the kernel, which stops the process at once; the process cannot catch it, so open files may be left inconsistent. Try 15 first.
22. What is a daemon?
A daemon is a background process that runs without a terminal and usually provides a service, such as sshd, crond or chronyd. On RHEL, systemd starts and supervises daemons.
23. How do you manage services with systemctl?
systemctl status sshd
systemctl start sshd
systemctl enable --now httpd # start now and at every boot
systemctl list-units --type=service --failed
start affects only the current boot; enable makes it start at boot.
24. How do you check disk space?
df -h shows free space per mounted filesystem. du -sh /var/log shows how much a directory uses. lsblk lists block devices and partitions.
25. How do you check memory usage?
free -h shows total, used and available memory plus swap. Look at the "available" column, because Linux uses spare RAM for the page cache and frees it when programs need it. /proc/meminfo has the details.
26. How do you create and delete users?
useradd -m alice # -m creates the home directory
passwd alice
usermod -aG wheel alice # add to the wheel group for sudo on RHEL
userdel -r alice # -r removes the home directory
27. What are /etc/passwd and /etc/shadow?
/etc/passwd lists accounts: name, UID, GID, comment, home directory and login shell. It is readable by everyone. Password hashes and ageing data live in /etc/shadow, which only root can read.
28. How do you install software on RHEL and Ubuntu?
RHEL, Fedora and Rocky use dnf with RPM packages: dnf install httpd, dnf update, dnf remove. Debian and Ubuntu use apt with .deb packages: apt update, then apt install nginx.
29. How do you check your IP address and test connectivity?
ip addr shows interfaces and addresses, ip route shows the default gateway, ping -c 4 host tests reachability and dig or nslookup checks DNS. On a minimal RHEL 10 install, use ip because ifconfig is not installed by default.
30. How do you connect to a remote server securely?
Use SSH: ssh user@host. Copy files with scp or rsync -avz. Key-based login is safer than passwords: create a key with ssh-keygen and copy it over with ssh-copy-id user@host.
Linux interview questions for 2 to 5 years of experience
31. What are stdin, stdout and stderr?
They are the three standard streams, with file descriptors 0, 1 and 2. > redirects stdout, 2> redirects stderr and &> redirects both.
./backup.sh > backup.log 2>&1
grep -r TODO . 2>/dev/null
32. What is a pipe?
A pipe (|) sends one command's stdout to the next command's stdin. For example, ps aux | grep java | wc -l counts lines that mention java.
33. What are environment variables?
They are named values that a process passes to its children, such as PATH, HOME and LANG. export VAR=value sets one for the current shell and its children; to keep it, add the line to ~/.bashrc. env lists them.
34. How do you schedule a recurring job?
Use cron. crontab -e edits your table. The five fields are minute, hour, day of month, month and day of week.
30 2 * * * /usr/local/bin/backup.sh
This runs at 02:30 every day. systemd timers are the alternative and log to the journal.
35. What is the sticky bit?
On a directory, the sticky bit lets only a file's owner (or root) delete or rename that file, even if others can write to the directory. /tmp uses it, shown as a t in drwxrwxrwt. Set it with chmod +t dir or chmod 1777 dir.
36. What are SUID and SGID?
SUID on an executable runs it with the file owner's privileges; /usr/bin/passwd uses it so users can update /etc/shadow. SGID on a directory makes new files inherit the directory's group, which is useful for shared team folders. Audit SUID files regularly, because a vulnerable one gives root.
37. How does sudo work?
sudo runs a command as another user, usually root, if the rules in /etc/sudoers or /etc/sudoers.d/ allow it. Edit those files with visudo, which checks syntax before saving. On RHEL, members of the wheel group get full sudo by default.
38. How do you read logs with journalctl?
journalctl -u nginx --since "1 hour ago"
journalctl -p err -b # errors since the current boot
journalctl -f # follow new entries
39. What is the difference between a process and a thread?
A process has its own memory space. Threads belong to a process and share its memory, so they are cheaper to create but need locking around shared data. ps -eLf lists threads.
40. What is a zombie process?
A zombie has finished but still has an entry in the process table because its parent has not read its exit status. It uses no CPU or memory beyond that entry. You cannot kill a zombie; fix or restart the parent, and init (systemd) will reap it.
41. What is load average?
The three numbers shown by uptime are the average count of runnable tasks, plus tasks in uninterruptible sleep (usually waiting on disk), over 1, 5 and 15 minutes. Compare them with the CPU count from nproc. A load of 8 on an 8-core server is busy but not necessarily overloaded.
42. How do you archive and compress files?
tar -czvf logs.tar.gz /var/log/app # create gzip archive
tar -xzvf logs.tar.gz -C /tmp # extract
tar -cJvf logs.tar.xz /var/log/app # xz, smaller but slower
43. How do you mount a filesystem permanently?
Add a line to /etc/fstab, preferably by UUID (from blkid), then run mount -a to test it before you reboot. A bad fstab entry can drop the system into emergency mode at boot.
UUID=1b2c... /data xfs defaults 0 0
44. What is swap?
Swap is disk space the kernel uses when RAM is full, by moving inactive memory pages out. It prevents some out-of-memory kills, but heavy swapping slows the system. swapon --show lists swap devices. The default filesystem on RHEL is XFS.
45. How do you see which process is using a port?
ss -tulpn | grep :8080 shows the listening socket and its process. lsof -i :8080 works too if lsof is installed.
46. How do you open a port in the firewall on RHEL?
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
firewall-cmd --list-all
firewalld uses nftables underneath on current RHEL releases.
47. What is SELinux, in one answer?
SELinux is mandatory access control built into the kernel. It labels processes and files and allows access only where the policy permits, even for root. RHEL runs it in enforcing mode by default. getenforce shows the mode, and denials are logged to /var/log/audit/audit.log. Fix labels with restorecon instead of disabling it.
48. Write a short Bash script that checks whether a service is running.
#!/bin/bash
svc="${1:-sshd}"
if systemctl is-active --quiet "$svc"; then
echo "$svc is running"
else
echo "$svc is not running" >&2
exit 1
fi
Expect follow-ups on quoting variables, exit codes ($?) and set -euo pipefail. Our guide on debugging shell scripts in Bash covers these.
Senior Linux interview questions
49. Describe the RHEL boot process.
Firmware (UEFI or BIOS) loads the GRUB2 bootloader. GRUB loads the kernel and the initramfs. The kernel starts, uses the initramfs to find and mount the real root filesystem, then runs systemd as PID 1. systemd brings up units until it reaches the default target, usually multi-user.target on servers. systemctl get-default shows the target.
50. What is the difference between a systemd unit and a target?
A unit is anything systemd manages: a service, socket, timer, mount or path. A target is a unit that groups other units into a system state, similar to the old runlevels. multi-user.target is roughly runlevel 3 and graphical.target is roughly runlevel 5.
51. What is the OOM killer?
When the kernel cannot free memory, the out-of-memory killer picks a process to kill based on its score, usually the one using the most memory. Find kills with journalctl -k | grep -i "out of memory". Admins tune it with oom_score_adj or with memory limits in systemd units and cgroups.
52. What are cgroups and namespaces?
Control groups (cgroups) limit and account for CPU, memory and I/O per group of processes. Namespaces isolate what a process can see: process IDs, network, mounts, hostname and users. Containers such as Podman and Docker are built from these two kernel features. RHEL uses cgroup v2.
53. How do you change kernel parameters at runtime and persistently?
sysctl net.ipv4.ip_forward # read
sysctl -w net.ipv4.ip_forward=1 # change now
echo "net.ipv4.ip_forward = 1" > /etc/sysctl.d/90-forward.conf
sysctl --system # load all config files
54. How do you find what is filling a disk?
Start with df -h to find the filesystem, then du -xh --max-depth=1 /var | sort -h to narrow it down. If df shows the disk full but du does not account for it, a deleted file may still be open; lsof +L1 lists those. Restarting the process that holds it releases the space.
55. How do you harden SSH?
Use key-based authentication and set PasswordAuthentication no and PermitRootLogin no in a file under /etc/ssh/sshd_config.d/. Limit access with AllowUsers or AllowGroups, keep the firewall closed to everyone except the networks that need SSH, and watch failed logins in the journal. Test with sshd -t before you reload, and keep a second session open.
56. How would you check a server's performance quickly?
Work through CPU, memory, disk and network: uptime and top for load and CPU, free -h and vmstat 1 for memory and swapping, iostat -x 1 (sysstat package) for disk latency, and ss -s for connection counts. Check journalctl -p err -b for errors at the same time.
Scenario-based Linux interview questions
These are short versions. For full walk-throughs, see the scenario-based Linux interview questions.
57. A user gets "Permission denied" running a script. What do you check?
Check the execute bit with ls -l and add it with chmod +x. Then check that the user can enter every parent directory, that the filesystem is not mounted noexec (findmnt), that the shebang line points to a real interpreter, and whether SELinux logged a denial.
58. You cannot SSH into a server. How do you troubleshoot?
Test from the client first: ping, then ssh -v user@host to see where it fails. On the server (through a console), check systemctl status sshd, ss -tlnp | grep :22, firewall-cmd --list-all and journalctl -u sshd. Key problems are often wrong permissions on ~/.ssh (700) or authorized_keys (600).
59. A website on the server returns nothing. Where do you start?
Confirm the web service is active, that it listens on the expected port with ss -tlnp, and that curl -I http://localhost works from the server itself. If it works locally but not remotely, look at the firewall. If it fails locally, read the service's error log and the journal.
60. The root filesystem is 100% full. What do you do?
Find the largest directories with du, usually logs under /var/log or old journals. Shrink the journal with journalctl --vacuum-size=500M, compress or move old logs, and clean the package cache with dnf clean all. Check lsof +L1 for deleted files still held open. Then set up log rotation so it does not happen again.
61. A process uses 100% CPU. How do you deal with it?
Identify it in top (press P to sort by CPU) and find what it is with ps -fp PID. Decide whether it is expected load or a runaway. Lower its priority with renice if it must keep running, or stop it with SIGTERM and then SIGKILL. Then check its logs to find the cause.
62. A service fails to start after a config change. What next?
Run systemctl status name and journalctl -xeu name to read the error. Use the service's own syntax check if it has one (nginx -t, httpd -t, sshd -t). If you cannot fix it quickly, restore the previous config file. Keep backups before every edit.
How to prepare for a Linux interview
- Install RHEL 10 (the no-cost Red Hat Developer subscription covers it) or a compatible distribution in a VM. Our RHEL 10 first-time setup guide walks through it.
- Type every command on this page and read its
manpage once. - Break things on purpose: fill a disk, stop sshd, change permissions, then fix them.
- Practise networking with
nmcli; see configuring networking in RHEL 10. - If you plan to certify, the RHCSA interview questions overlap heavily with this list.
For a structured path with lab practice, see our Linux administration training or the RHCSA training, available in Kharadi, Pune and live online. For other DevOps topics, start at the DevOps interview questions hub.
FAQ
What Linux questions are asked most in fresher interviews?
The common ones are: what Linux and the kernel are, the filesystem hierarchy, hard versus soft links, file permissions and chmod, how to list and kill processes, how to manage services with systemctl, and basic commands for disk space, memory, logs and networking.
Which Linux distribution should I practise on?
Practise on RHEL 10 or a compatible distribution if you are aiming for enterprise or RHCSA roles, and on Ubuntu if your target companies use it. The concepts are the same; package management (dnf versus apt) and some default tools differ.
Is ifconfig still asked about in interviews?
Sometimes, but interviewers expect you to know the replacement. On RHEL 10, use ip addr for addresses, ip route for routes, ss instead of netstat, and nmcli to configure connections.
How many Linux commands should a fresher know?
There is no fixed number. Aim to use about 40 to 50 everyday commands without notes: file handling, grep and find, permissions, processes, systemctl, journalctl, df, du, free, ip, ss, ssh, tar and a package manager.
Do Linux interviews include shell scripting?
Yes, usually at a basic level for freshers: variables, if statements, loops, exit codes and redirection. Experienced roles expect scripts that handle errors and run safely from cron or systemd timers.
What is the difference between this page and the scenario-based Linux questions?
This page covers definitions and everyday commands that first-round interviewers ask. The scenario-based page walks through troubleshooting problems step by step, which is more common in later rounds and for experienced candidates.
Is RHCSA useful for Linux interviews?
RHCSA is a performance-based exam, so preparing for it builds the hands-on skill interviewers test. It is widely recognised for RHEL administrator roles. Check current exam details on the Red Hat website.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0