Linux is an open-source operating system that has evolved into a cornerstone of the tech world. Whether you're stepping into the Linux environment for the first time or looking to solidify your foundational knowledge, this quiz will serve as an insightful learning resource.
Dive in and test your understanding of the Linux operating system's fundamentals and commands with these 25 multiple-choice questions.
1. Which command is used to display the contents of a file?
Answer:
Explanation:
The 'cat' command is used to display the contents of a file.
2. Which of the following is the Linux command to change directories?
Answer:
Explanation:
The 'cd' command is used to change directories.
3. What is the default shell in Linux?
Answer:
Explanation:
The 'bash' or Bourne Again SHell is the default shell for most Linux distributions.
4. Which command will display the current working directory?
Answer:
Explanation:
The 'pwd' command displays the present working directory.
5. How do you list the hidden files in a directory?
Answer:
Explanation:
The 'ls -a' command lists all files, including hidden ones.
6. Which symbol represents the root directory in Linux?
Answer:
Explanation:
In Linux, the root directory is represented by a forward slash (/).
7. Which command is used to remove a directory?
Answer:
Explanation:
The 'rmdir' command is used to remove empty directories.
8. How do you print the first 10 lines of a file named 'file.txt'?
Answer:
Explanation:
The 'head' command with the '-10' option prints the first 10 lines of the specified file.
9. Which command displays a file's type?
Answer:
Explanation:
The 'file' command is used to determine the type of a file.
10. What is the command to search for a pattern in a file?
Answer:
Explanation:
The 'grep' command searches files for a specified pattern.
11. Which command is used to see the running processes in Linux?
Answer:
Explanation:
The 'top' command displays a live, updating view of the running processes.
12. What does the command chmod 777 filename do?
Answer:
Explanation:
The chmod 777 command gives all permissions (read, write, and execute) to the owner, the group, and everyone else.
13. Which command is used to find files in a directory?
Answer:
Explanation:
The 'find' command is used to search and locate the list of files and directories based on conditions.
14. How do you display the last ten lines of a file in Linux?
Answer:
Explanation:
The 'tail' command by default shows the last ten lines of a file.
15. Which command is used to create a symbolic link?
Answer:
Explanation:
The 'ln' command is used to create links between files. The '-s' option creates a symbolic link.
16. How do you display your Linux system information?
Answer:
Explanation:
The uname -a command displays all the system information, including machine name, OS, kernel, etc.
17. Which command is used to stop a process in Linux?
Answer:
Explanation:
The 'kill' command is used to terminate a process manually.
18. What does the man command do?
Answer:
Explanation:
The man command in Linux is used to display the user manual of any command that we can run on the terminal.
19. What command can replace characters in a file?
Answer:
Explanation:
The 'sed' command, also known as stream editor, can be used to perform basic text transformations on an input stream (a file or input from a pipeline).
20. Which command shows disk usage?
Answer:
Explanation:
The 'du' (Disk Usage) command is used to check the directory size in Linux.
21. What is the primary role of the sudo command?
Answer:
Explanation:
The sudo command allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file.
22. What is the purpose of the ls command?
Answer:
Explanation:
The ls command is commonly used to list the files and directories in the current working directory.
23. How do you search for a specific word within a file?
Answer:
Explanation:
The grep command is used to search for specific text or patterns in a file.
24. If you want to repeat the last command in Linux, what would you type?
Answer:
Explanation:
Typing !! in the terminal and pressing enter will execute the last command.
25. How would you compress files using the Linux command line?
Answer:
Explanation:
The gzip command is used to compress files. The files will then have a ".gz" extension.
26. Which command can you use to change the permissions of a file?
Answer:
Explanation:
The chmod command is used to change the permissions of a file or directory.
Comments
Post a Comment
Leave Comment