Welcome to the UNIX Quiz! This quiz provides 25 Multiple Choice Questions (MCQ) covering a broad overview of the fundamental concepts and commands associated with the UNIX operating system. It is crucial for professionals and students to familiarize themselves with these basics for efficient use of UNIX and its various distributions. Dive into the quiz!
1. Which Unix command is used to display the contents of a file?
Answer:
Explanation:
The cat command is used to display the contents of a file. It stands for "concatenate and display".
2. Which Unix command is used to count the number of lines, words, and characters in a file?
Answer:
Explanation:
The wc command stands for "word count" and is used to display the number of lines, words, and characters in a file.
3. What does the grep command do?
Answer:
Explanation:
grep stands for "global regular expression print" and is used to search for a specific string or pattern inside a file.
4. What is the purpose of the chmod command?
Answer:
Explanation:
The chmod command is used to change the permissions of a file or directory.
5. Which of the following commands is used to remove a directory?
Answer:
Explanation:
The rmdir command is used to remove empty directories.
6. The pwd command in UNIX is used for:
Answer:
Explanation:
pwd stands for "print working directory" and it displays the path of the current directory.
7. Which command will display all hidden files in a directory?
Answer:
Explanation:
The ls -a command lists all entries, including those that start with a dot, which are hidden files in UNIX.
8. What does the >> operator do in UNIX?
Answer:
Explanation:
The >> operator is used to append the output of a command to a file. If the file does not exist, it creates one.
9. Which Unix command displays the manual or help pages of a command?
Answer:
Explanation:
The man command is used to display the manual or help pages of a command. It stands for "manual".
10. Which Unix command is used to display the process status?
Answer:
Explanation:
The ps command is used to display information about the currently running processes.
11. What does the kill command do in UNIX?
Answer:
Explanation:
The kill command is used to send signals to processes, allowing you to stop, pause, or otherwise signal processes.
12. Which Unix command can be used to display disk usage?
Answer:
Explanation:
The du command stands for "disk usage" and is used to estimate and display the disk space used by files.
13. The which command in UNIX is used to:
Answer:
Explanation:
The which command is used to locate the binary of a command to see where it resides on disk.
14. The alias command in UNIX is used for:
Answer:
Explanation:
The alias command allows users to create shortcuts or abbreviations for longer command sequences.
15. Which of the following commands will display the last 100 lines of a file named "data.txt"?
Answer:
Explanation:
The tail command displays the last few lines of a file. With the -n option, you can specify the number of lines to display.
16. What is the primary purpose of the crontab command?
Answer:
Explanation:
The crontab command is used to create, read, update, and delete cron jobs for a user. Cron jobs are tasks scheduled to run at specific intervals.
17. Which of the following commands is used to sort the contents of a file?
Answer:
Explanation:
The sort command is used to sort the lines in a text file.
18. Which command allows you to substitute a string in a file?
Answer:
Explanation:
sed, or stream editor can be used to perform basic text transformations on an input stream or file.
19. Which command is used to find the location of a program in UNIX?
Answer:
Explanation:
While both find and locate can be used to search for files, the which command is specifically used to locate the executable file associated with a given command.
20. Which command is used to send the output of one command as the input to another command?
Answer:
Explanation:
The pipe (|) is used to send the output of one command as input to another command.
21. What does the chown command do?
Answer:
Explanation:
The chown command is used to change the owner (and optionally the group) of a file or directory.
22. The ln command in UNIX is used to:
Answer:
Explanation:
The ln command is used to create links between files.
23. Which command is used to repeat the last executed command in UNIX?
Answer:
Explanation:
In many UNIX shells, !! is used to repeat the last executed command.
24. What does the $? variable signify in UNIX?
Answer:
Explanation:
In UNIX, $? gives the exit status of the last command executed. An exit status of 0 usually indicates success, while any other value indicates an error.
25. The touch command in UNIX is primarily used to:
Answer:
Explanation:
The touch command is primarily used to create empty files and can also change the timestamps on existing files.
Comments
Post a Comment
Leave Comment