Linux Interview Questions Part- 1
Top Linux Interview Questions for Learners.
1. What is Linux?
Explain the difference between Linux, a kernel, and an operating system.
2. Explain the File System Hierarchy in Linux.
Discuss the structure and purpose of directories like /bin
, /home
, /etc
, /var
, /usr
, and others.
3. What are the basic file permissions in Linux?
How does the permission model work for files and directories in Linux?
Explain the significance of
r
,w
, andx
for users, groups, and others.
4. How do you change file permissions?
Command to change file permissions:
chmod
Command to change ownership:
chown
What are symbolic and numeric modes for permissions?
5. What are the differences between sudo
and su
?
- Describe when and why you would use
sudo
oversu
and vice versa.
6. What is a shell?
Explain the concept of a shell in Linux.
Name different types of shells, like Bash, Zsh, etc.
How do you change the default shell?
7. Explain the purpose of environment variables in Linux.
What are some common environment variables like
PATH
,HOME
, andUSER
?How do you create and manage environment variables?
8. How do you check the current running processes?
Discuss commands like
ps
,top
,htop
, andpgrep
.How would you kill a process using
kill
,killall
, orpkill
?
9. What is the difference between hard links and soft (symbolic) links?
Describe how hard links and symbolic links are created.
When should you use each type?
10. Explain package management in Linux.
What are some package managers used in Linux, like
apt
,yum
,dnf
, andpacman
?How do you install, update, and remove packages?
11. How do you search for files in Linux?
Explain the use of
find
andlocate
commands.How do you search for a specific text within files using
grep
?
12. How do you view the content of a file?
Explain the use of commands like
cat
,less
,more
,head
, andtail
.How do you follow a log file in real-time using
tail -f
?
13. What is cron
and how do you schedule jobs using it?
Explain the format of a cron job.
How do you view, add, or remove cron jobs for a user?
14. What are system logs and where are they stored?
Explain the purpose of logs and the location of system logs in
/var/log
.How do you use
journalctl
to view system logs?
15. What is the difference between df
and du
commands?
How do you check disk usage and available space?
What are some useful flags for these commands?
16. How do you manage services in Linux?
- How do you start, stop, restart, and check the status of services using
systemctl
andservice
commands?
17. What is the difference between a terminal emulator and a shell?
- Describe the relationship between terminal emulators (like GNOME Terminal, Konsole) and shells (like Bash, Zsh).
18. How do you compress and extract files in Linux?
Explain how to use commands like
tar
,gzip
,bzip2
,zip
, andunzip
.Whatโs the difference between
gzip
andbzip2
?
19. How do you redirect output in Linux?
Explain input/output redirection using
>
,>>
, and2>
for standard output and error streams.How do you use pipes (
|
) to chain commands together?
20. What is SSH and how do you use it to connect to a remote server?
- How do you set up an SSH connection and copy files using
scp
orrsync
?
Advanced Linux Interview Questions (Optional)
21. Explain how networking works in Linux.
- What commands are used to check network interfaces (
ip
,ifconfig
) and troubleshoot network issues (ping
,netstat
,traceroute
)?
22. What is iptables
and how is it used in Linux?
- Explain the role of
iptables
in firewall configuration.
23. What is a Linux kernel module?
- How do you list, load, and unload kernel modules using commands like
lsmod
,modprobe
, andrmmod
?
24. What is LVM (Logical Volume Management)?
- Explain how LVM is used to manage disk storage dynamically and how to create, extend, and reduce LVM volumes.
25. How do you monitor system performance in Linux?
Discuss tools like
vmstat
,iostat
,sar
, andfree
.How do you track CPU, memory, and disk performance?