Introduction to Linux Interview Questions
As Linux continues to gain popularity in the tech industry, mastering its intricacies has become crucial for IT professionals. This blog post will guide you through the top 50 Linux interview questions for 2025, ensuring you are well-prepared for your next job interview Linux Interview
![](https://interviewcrack.com/wp-content/uploads/2024/08/Linux-Interview-768x432-1.jpg)
1. How do you access partitions?
Partitions in Linux are numbered. If drive /dev/hda has three partitions, they would be accessed as /dev/hda1, /dev/hda2, and /dev/hda3.
Folders, files, and links
Linux has a specific directory structure installed with the operating system. Within this structure, Linux administrators maintain a set of folders, files, and links to provide access and security to the data and executables stored on the server.
2. What are the three kinds of permissions under Linux?
Read, write, and execute. Files and folders are assigned one or a combination of these access rights.
3. How do you change permissions to a folder or file?
If you are the system administrator or owner of the file or folder, you can use the chmod command. The command takes the following parameters:
- [optional used in symbolic mode] Character string indicating who to apply the permissions to (u-user, g-group, o-others, or a-all)
- + or – to add or deny permissions
- Permission types: r-read, w-write, x-execute
- The file or folder to apply the permissions to
In symbolic mode, users, groups, and others are provided different access levels to a file:
chmod u=rwx,g=rx,o=r filename
In absolute mode, there is general access to the file set:
chmod rwx filename
4. What is the maximum length of a file name?
Excluding the path, the file name can be up to 255 characters.
5. What is the significance of a dot at the start of a file name?
The dot indicates it is a hidden file.
Some of basic questions and answers read carefully and improve your skills and basic thing
6. What are symbolic links?
Symbolic links are a type of file in Linux that point to or reference another file or folder. These are also called symlinks or soft links.
7. What are hard links?
A hard link is a type of file in Linux that points to the data of another file. The pointer is called an “inode” in file system terminology. If the original source file is deleted, the file remains accessible through the hard link.
Shells and GUIs
8. What is a shell?
A shell is a program that takes commands as input and submits them to the OS for execution. The commands can come from a CLI text-based or a GUI graphical shell.
9. What is CLI?
The Command Line Interface (CLI) allows the user to enter declarative commands for the OS to execute.
10. What is GUI?
The Graphical User Interface (GUI) renders images users can interact with to communicate with the computer. For example, a button to be clicked.
Line Commands
11. Can you name some line commands related to manipulating files?
cp [from file] [to file] Copy a file to a new file
mv [from file] [to file] Move a file
rm [filename] Delete a file
rm -rf Delete all files in the directory without confirmation
touch [filename] Create a file without opening it
sort [filename] Sort entries in a file in ascending order
12. Can you name some line commands related to displaying and listing directories?
pwd Print working directory prints the current directory
ls List the files and directories in the current directory
cd Change to a new directory
mkdir Make a new directory
rmdir Delete a directory
Linux students also learn
Linux Administration Linux Command Line Command Line Bash Shell Shell Scripting Ethical Hacking Ubuntu Red Hat Certified System Administrator (RHCSA) Cybersecurity Kali Linux Linux LPIC-1 Automation System Programming DevOps
du -sh [directory] Calculate the size of a directory
13. How do you search a file or find the location of a file?
grep Search files for a string pattern
locate Prints the location of a file
14. How do you list active processes? Can you stop one from running?
ps List running processes
ps ux Get the status of a process
Kill [pid] Stop a process. A pid of 0 will stop all processes.
15. What is the service command, and can you describe how you would use it?
You would use the service command to monitor and control processes and daemons. Some example uses include:
service [name] status Check the status of a service
service status-all Check the status of all services
service [name] start Start a service
service [name] stop Stop a service
service [name] restart Restart a service
16. What kinds of processes and daemons accept service commands?
All scripts in the /etc/init.d directory accept service commands. Some of these processes include ssl/httpd and sshd.
Redirection
17. What is redirection?
Redirection allows the user to change the standard input/output/error device. Linux administrators use these commands to configure the environment and monitor processes.
18. What are the three file descriptors used with redirection?
STDOUT, STDIN, and ERROR
19. What is the redirection symbol for the Output file descriptor?
The symbol “>” is used for the STDOUT redirection.
20. Can you list some Output examples?
ls -al > listings
The output from the command “ls -al” will be put in a file named listings instead of the standard output (STDOUT) device, the screen.
cat listings
The command cat dumps a file out. Without redirection, the contents of the file display on the screen.
Empower your team. Lead the industry.
Get a subscription to a library of online courses and digital learning tools for your organization with Udemy Business.
Request a demo
cat file1 >> file2
This appends file1 to the end of file2. The double symbol “>>” will create file2 if it does not exist.
cat file1 file2 file3 > file4
This appends file1, file2, and file3 to the end of file4. It will not create file4 if it does not exist.
cat my_song.mp3 > /dev/audio
Redirection can send data to a device. In this case, if you configure the audio device, this will copy the contents of my_song.mp3 to the audio device, and it will play.
$my_program 1>output.txt
The file descriptor for STDOUT is 1. In this case, when my_program executes, any non-error output will log to the output.txt file.
21. What is the redirection symbol for the Standard In (STDIN) redirection?
The symbol “<” is used for the STDIN redirection.
22. Can you list an example of the STDIN redirection?
$ mail -s [subject] [email of recipient] < send_me.txt
This mail command sends an email to the email address with the file send_me.txt attached.
23. What are the file descriptors for STDIN and STDOUT?
The file descriptor for STDIN is 0, and STDOUT is 1.
24. What is the redirection system for the Error file descriptor?
By default, all errors stream to the terminal window. The file descriptor for STDERR is 2. You can use this with an ampersand to redirect to a file.
25. What is Linux?
Linux is an operating system (OS) introduced by Linus Torvalds. It is based on the Unix operating system.
26. What is the difference between Unix and Linux?
Unix is a commercial operating system introduced by AT&T Bell Labs in the early 1970s. Linux is a Unix clone developed as a free, open-source, non-proprietary operating system. Linux was built by Linux Torvalds and released in 1991.
27. What is the Linux Kernel?
The Linux Kernel is a multitasking software program tasked with efficiently managing the computer hardware and the Linux operating system.
28. What is LILO?
LILO (Linux Loader) is a boot loader that loads the Linux OS into memory so that it can start operating.
29. What is Bash?
Bash is an application. When the user opens a text or terminal window into Linux, they run a Bash shell where they enter commands interpreted and executed by the Bash shell.
30. Describe the root account.
Root is the superuser account in Linux. As the system administrator, this user has access to the highest rights in the system.
31. What is swap space?
Swap space is the portion of virtual memory on the hard drive. It is used as overflow when RAM is full or to store data for programs not used often.
32. What is the typical size for a swap partition?
For systems that use hibernation, the minimum swap space size should be equal to the RAM size. Without hibernation, the minimum should be (round(sqrt(RAM)). The maximum swap space size should be twice the RAM.
33. Name some editors you have used in Linux.
Vi and VIM are the top editors in Linux. Other options include Nano, Gedit, GNU Emacs, and Pico.
34. What does the CTRL+ALT+DEL key combination do?
A system restart similar to Windows, but the difference is there is no message – the restart process is immediate.
35. What is a virtual desktop?
A virtual desktop is a desktop environment running on a remote server instead of a local PC or computer. The virtualization software separates the desktop, programs, and data from the client hardware.
36. How do you switch between desktops? For example, KDE and Gnome?
Workspace switcher software allows the user to click on the desktop to switch to. Using keys, the CTRL+ALT+right or left arrow keys change to different running desktops.
Linux Environment
Ports, drives, and partitions
Devices and the ability to access and maintain them is important. Whether you are setting up a network printer, provisioning a new server, or analyzing a problem, it is important to understand the system’s structure and I/O components.