Linux and Bash course menu
Linux Interview Questions for Beginners and Freshers
Beginner Linux interview questions with answers: kernel and distributions, basic commands, the file system, permissions, pipes, grep and finding files.
On this page
- Basics
- 1. What is Linux?
- 2. What is the kernel?
- 3. What is a shell?
- 4. What is the difference between root and a normal user?
- 5. Explain absolute and relative paths.
- Files
- 6. What are /etc, /var and /home for?
- 7. How do you list hidden files?
- 8. How do you copy, move and delete a folder?
- 9. What is the difference between cat, less, head and tail?
- 10. What is a symbolic link?
- Permissions
- 11. Explain the permission string -rwxr-xr--.
- 12. What do chmod 755 and chmod 644 mean?
- 13. What is the difference between chmod and chown?
- Text and search
- 14. What does the pipe do?
- 15. What is the difference between > and >>?
- 16. How do you search for text in files?
- 17. How do you find a file by name?
- System
- 18. How do you see running processes, and stop one?
- 19. How do you check disk space and memory?
- 20. How do you install software on Ubuntu?
These questions come up in most interviews for fresher roles in development, support, testing and DevOps. Try answering aloud before you read each answer.
Basics#
1. What is Linux?#
Show solution
A free, open source, Unix-like operating system. Strictly, Linux is the kernel; a distribution such as Ubuntu or Red Hat adds tools and a package manager. It runs most servers and cloud systems.
2. What is the kernel?#
Show solution
The core of the operating system. It manages the CPU, memory, devices and processes, and gives programs a controlled way to use the hardware through system calls.
3. What is a shell?#
Show solution
A program that reads your commands and runs them. Bash is the most common. The terminal is the window that displays the shell.
4. What is the difference between root and a normal user?#
Show solution
root (UID 0) has full control of the system. Normal users can change only what they have permission for, and use sudo to run single commands with administrator rights.
5. Explain absolute and relative paths.#
Show solution
An absolute path starts at /, as in /home/asha/notes.txt. A relative path starts from the current folder, as in ../notes.txt.
Files#
6. What are /etc, /var and /home for?#
Show solution
/etc holds system configuration, /var holds changing data such as logs, and /home holds users' personal folders.
7. How do you list hidden files?#
Show solution
ls -a. Hidden files have names that begin with a dot. ls -la adds details.
8. How do you copy, move and delete a folder?#
Show solution
cp -r src dest copies, mv src dest moves or renames, and rm -r folder deletes. rm is permanent, since there is no recycle bin.
9. What is the difference between cat, less, head and tail?#
Show solution
cat prints a whole file, less lets you scroll through long files, head shows the start, and tail shows the end. tail -f follows a file as it grows.
10. What is a symbolic link?#
Show solution
A special file that points to another path, created with ln -s target name. If the target is removed, the link no longer works. A hard link (ln) is another name for the same data.
Permissions#
11. Explain the permission string -rwxr-xr--.#
Show solution
It is a file. The owner can read, write and execute, the group can read and execute, and others can only read. In numbers, it is 754.
12. What do chmod 755 and chmod 644 mean?#
Show solution
755 is rwxr-xr-x: the owner has full access, and others can read and execute. It suits scripts and folders. 644 is rw-r--r--: the owner can write, and others can only read. It suits normal files.
13. What is the difference between chmod and chown?#
Show solution
chmod changes the permissions, and chown changes the owner and group.
Text and search#
14. What does the pipe do?#
Show solution
| sends the output of one command to the input of another, as in ls | wc -l.
15. What is the difference between > and >>?#
Show solution
> replaces a file with the output, and >> adds it to the end.
16. How do you search for text in files?#
Show solution
grep "text" file. Add -i to ignore case, -r to search folders, -n for line numbers, and -v to invert the match.
17. How do you find a file by name?#
Show solution
find /path -name "file.txt". -iname ignores case, and -type f restricts it to files.
System#
18. How do you see running processes, and stop one?#
Show solution
ps aux lists processes, and top shows them live. kill PID asks a process to stop, and kill -9 PID forces it.
19. How do you check disk space and memory?#
Show solution
df -h shows free disk space, du -sh folder shows a folder's size, and free -h shows memory.
20. How do you install software on Ubuntu?#
Show solution
sudo apt update, and then sudo apt install name. On Red Hat systems, use dnf.
Next: Intermediate Questions.
Finished this lesson?