Practice high-yield Computer Science & IT MCQs on Unix — Part 1 with worked academic solutions for PPSC, FPSC, CSS, PMS, NTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
PPSC, FPSC, CSS...
Estimated Time
48 mins
Exam-Level PPSC FPSC CSS PMS NTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which symbol will be used with grep command to match the pattern pat at the beginning of a line?
Correct Answer: Option A — ^pat
Detailed Academic Explanation:
In Unix, when using the grep command, the caret (^) symbol is used to match patterns at the beginning of a line . So, if you use ^pat with grep , it will match all the lines that start with the pattern "pat" . The caret (^) is called a metacharacter in regular expressions and it anchors the search pattern to the beginning of a line . When you use ^pat , grep will only return lines where the pattern "pat" occurs at the beginning of the line . This means that if "pat" occurs anywhere else in the line (not at the beginning), it won't be considered a match. So, to summarize, ^pat is the correct option because it specifically instructs grep to find lines where "pat" appears at the very beginning.
💡Key Conceptual Anchor:Unix
Question 2 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to sort the lines of data in a file in reverse order
Correct Answer: Option D — sort -r
Detailed Academic Explanation:
In Unix, the sort command is used to sort the lines of data in a file. By adding the -r option to the sort command, you can sort the lines in reverse order . So, sort -r is the correct command to sort the lines of data in a file in reverse order.
💡Key Conceptual Anchor:Unix
Question 3 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to display the top of the file?
Correct Answer: Option B — head
Detailed Academic Explanation:
In Unix, the head command is used to display the top part of a file. It prints the first 10 lines of the specified file by default. If you want to display a different number of lines, you can specify it using the -n option followed by the number of lines you want to display. So, head is the correct command to display the top of a file.
💡Key Conceptual Anchor:Unix
Question 4 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to copy all files having the string chap and any two characters after that to the progs directory?
Correct Answer: Option A — cp chap?? progs
Detailed Academic Explanation:
In Unix, the cp command is used to copy files or directories. The pattern chap?? matches files with the string chap followed by any two characters. When followed by progs , it indicates that all files matching this pattern should be copied to the progs directory. So, cp chap?? progs is the correct command to copy all files having the string chap and any two characters after that to the progs directory.
💡Key Conceptual Anchor:Unix
Question 5 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to change protection mode of files starting with the string emp and ending with 1,2, or 3?
Correct Answer: Option A — chmod u+x emp[1-3]
Detailed Academic Explanation:
In Unix, the chmod command is used to change the permissions or protection mode of files or directories. The pattern emp[1-3] matches files starting with the string emp and ending with 1 , 2 , or 3 . By adding u+x to the chmod command, it grants execute permission to the owner of the file. So, chmod u+x emp[1-3] is the correct command to change the protection mode of files starting with the string emp and ending with 1 , 2 , or 3 .
💡Key Conceptual Anchor:Unix
Question 6 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to remove a directory?
Correct Answer: Option B — rmdir
Detailed Academic Explanation:
In Unix, the rmdir command is used to remove or delete a directory. It is specifically designed to remove directories and will only work if the directory is empty. If the directory contains any files or subdirectories, rmdir will not remove it and will generate an error message. So, rmdir is the correct command to remove a directory.
💡Key Conceptual Anchor:Unix
Question 7 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following keys is used to replace a single character with new text?
Correct Answer: Option B — r
Detailed Academic Explanation:
In Unix command line editors like vi or Vim, the s key is used in the command mode to replace a single character under the cursor with new text. After pressing s , you can enter the replacement text, and the character under the cursor will be replaced with it. So, s is the correct key to replace a single character with new text.
💡Key Conceptual Anchor:Unix
Question 8 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to extract specific columns from the file?
Correct Answer: Option B — cut
Detailed Academic Explanation:
In Unix, the cut command is used to extract specific columns from a file. It allows you to specify which columns you want to extract based on delimiters like space or tab. So, cut is the correct command to extract specific columns from a file.
💡Key Conceptual Anchor:Unix
Question 9 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command sends the word count of the file infile to the newfile.
Correct Answer: Option A — wc infile >newfile
Detailed Academic Explanation:
In Unix, the wc command is used to count words, lines, and characters in a file. The > symbol is used for output redirection, which means that the output of the command preceding it will be written to the specified file. So, wc infile > newfile is the correct command to send the word count of the file infile to the newfile .
💡Key Conceptual Anchor:Unix
Question 10 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to remove the read permission of the file 'note' from both the group and others?
Correct Answer: Option D — chmod go-r note
Detailed Academic Explanation:
In Unix, the chmod command is used to change the permissions of a file. Here, go-r specifies that read permission should be removed for both the group (g) and others (o) . So, chmod go-r note is the correct command to remove the read permission of the file 'note' from both the group and others.
💡Key Conceptual Anchor:Unix
Question 11 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following commands is used to display the directory attributes rather than its contents?
Correct Answer: Option A — ls -l -d
Detailed Academic Explanation:
In Unix, the ls command is used to list directory contents. By using the -l option, it displays detailed information about the files and directories. Adding the -d option makes ls display the attributes of the directory itself rather than its contents. So, ls -l -d is the correct command to display the directory attributes rather than its contents.
💡Key Conceptual Anchor:Unix
Question 12 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following files will displayed by this command cat *ch*
Correct Answer: Option D — All of the above
Detailed Academic Explanation:
In Unix, the command cat ch will display the contents of all files in the current directory that have "ch" in their filenames. Therefore, it will display the contents of files like patch , catch , and .ch . So, All of the above files will be displayed by the command cat ch .
💡Key Conceptual Anchor:Unix
Question 13 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
The Octal number to be given alogn with chmod command to make a file readable, writable and executable to the owner, readable and executable to group and others is:
Correct Answer: Option B — 755
Detailed Academic Explanation:
In Unix, file permissions are represented by three digits in octal form. Each digit corresponds to a set of permissions: the first digit for the owner, the second for the group, and the third for others. The permissions are represented by adding up the values for read (4), write (2), and execute (1). For the owner to have read, write, and execute permissions (7 = 4 + 2 + 1). For the group and others to have read and execute permissions (5 = 4 + 1). So, the octal number to be given along with the chmod command to achieve these permissions is 755 .
💡Key Conceptual Anchor:Unix
Question 14 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
If you are to use [Control-c] as the interrupt key instead of [Del], then you will have to use
Correct Answer: Option B — stty intr ^c
Detailed Academic Explanation:
In Unix, the stty command is used to change or display terminal settings. The intr option is used to specify the interrupt key, which is used to interrupt or terminate the current process. By default, the interrupt key is set to ^c , which represents Control-c . So, to use Control-c as the interrupt key, you would use the command stty intr ^c . Therefore, Option B: stty intr ^c is the correct command to set Control-c as the interrupt key.
💡Key Conceptual Anchor:Unix
Question 15 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following keys is used to move the cursor to the end of the paragraph.
Correct Answer: Option E — None of the above
Detailed Academic Explanation:
In Unix, to move the cursor to the end of the paragraph, the key used is G (capital G) in vi or Vim . Therefore, None of the above options correspond to the key used to move the cursor to the end of the paragraph.
💡Key Conceptual Anchor:Unix
Question 16 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to concatenate all files beginning with the string 'emp' and followed by a non-numeric characters?
Correct Answer: Option A — cat emp[!0-9]
Detailed Academic Explanation:
In Unix, the command cat emp[!0-9] is used to concatenate all files beginning with the string 'emp' and followed by a non-numeric character. Here, the square brackets denote character classes, and the exclamation mark (!) negates the character class. So, [!0-9] matches any character that is not a numeric character. Therefore, Option A: cat emp[!0-9] is the correct command to concatenate all files beginning with the string 'emp' and followed by a non-numeric character.
💡Key Conceptual Anchor:Unix
Question 17 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is
Correct Answer: Option A — tee
Detailed Academic Explanation:
In Unix, the tee command reads the standard input and writes it to both the standard output and one or more files, effectively making a copy of the input. This can be useful when you want to see the output of a command on the screen while also saving it to a file. So, tee is the correct command to transcribe the standard input to the standard output and also make a copy of the same in a file.
💡Key Conceptual Anchor:Unix
Question 18 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to remove a file?
Correct Answer: Option B — rm
Detailed Academic Explanation:
In Unix, the rm command is used to remove or delete files and directories. It stands for "remove". So, rm is the correct command to remove a file.
💡Key Conceptual Anchor:Unix
Question 19 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which symbol is used to separate more than one command in the same command line?
Correct Answer: Option D —
Detailed Academic Explanation:
In Unix, the semicolon ( ; ) symbol is used to separate more than one command in the same command line. This allows you to execute multiple commands sequentially on a single command line. So, ; is the symbol used to separate more than one command in the same command line.
💡Key Conceptual Anchor:Unix
Question 20 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
The agency that sits between the user and the UNIX system is called the
Correct Answer: Option C — shell
Detailed Academic Explanation:
In Unix, the agency that sits between the user and the UNIX system is called the shell . The shell is a command-line interpreter that takes commands from the user and executes them. It provides an interface for users to interact with the operating system, allowing them to run programs, manipulate files, and perform various tasks. So, shell is the correct term for the agency that sits between the user and the UNIX system.
💡Key Conceptual Anchor:Unix
Question 21 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following commands is used to update access and modification times of a file?
Correct Answer: Option C — touch
Detailed Academic Explanation:
In Unix, the touch command is used to update access and modification times of a file. If the file specified doesn't exist, touch creates an empty file with the specified name. So, touch is the correct command to update access and modification times of a file.
💡Key Conceptual Anchor:Unix
Question 22 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to count just the number of characters in a file?
Correct Answer: Option B — wc -c
Detailed Academic Explanation:
In Unix, the wc command is used to count words, lines, and characters in a file. The -c option specifically instructs wc to count just the number of characters in the file. So, wc -c is the correct command to count just the number of characters in a file.
💡Key Conceptual Anchor:Unix
Question 23 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following commands is used to list contents of directories?
Correct Answer: Option A — ls
Detailed Academic Explanation:
In Unix, the ls command is used to list the contents of directories. It displays the names of files and directories in the specified directory. So, ls is the correct command to list contents of directories.
💡Key Conceptual Anchor:Unix
Question 24 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to display a file contents in octal form?
Correct Answer: Option B — od
Detailed Academic Explanation:
In Unix, the od command is used to display file contents in octal form. It stands for "octal dump". So, od is the correct command to display a file's contents in octal form.
💡Key Conceptual Anchor:Unix
Question 25 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command will be used with vi editor to insert text to left of cursor?
Correct Answer: Option D — None of the above
Detailed Academic Explanation:
In the vi editor, the i command is used to insert text before the cursor position. Conversely, the a command is used to insert text after the cursor position. Therefore, to insert text to the left of the cursor, you would use the i command. So, i is the command used with the vi editor to insert text to the left of the cursor.
💡Key Conceptual Anchor:Unix
Question 26 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
In vi editor, forward search is performed using the command.
Correct Answer: Option C — /pat
Detailed Academic Explanation:
In the vi editor, forward search is performed using the / command followed by the pattern you want to search for. This command allows you to search forward from the current cursor position for the specified pattern. So, /pat is the command used in the vi editor for forward search.
💡Key Conceptual Anchor:Unix
Question 27 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following special shell variables is used to process number of the last background job?
Correct Answer: Option A — $!
Detailed Academic Explanation:
In Unix shell scripting, the $! special variable is used to process the number of the last background job. It holds the process ID (PID) of the last command run in the background. So, $! is the special shell variable used to process the number of the last background job.
💡Key Conceptual Anchor:Unix
Question 28 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which option will be used with ps command to slow the entire command line of the process being run?
Correct Answer: Option E — None of the above
Detailed Academic Explanation:
In Unix/Linux , the ps command is used to display information about active processes. To show the entire command line of the process being run, the correct option is -f (full format) or -w (wide output) , not the given options. The commonly used options for displaying the full command line are: ps -f → Displays full-format listing, including command-line arguments. ps -ef → Shows all processes in full format. ps aux → Provides detailed information about all running processes. Since none of the given options (-4, -3, -1, -2) are correct, the correct answer is None of the above.
💡Key Conceptual Anchor:Unix
Question 29 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following command addresses all users who are currently hooked on?
Correct Answer: Option C — wall
Detailed Academic Explanation:
In Unix, the wall command is used to send a message to all users who are currently logged in. It stands for "write all". This command sends a message to all terminals except those who have disabled messages using the mesg command. So, wall is the command that addresses all users who are currently hooked on.
💡Key Conceptual Anchor:Unix
Question 30 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which option is used with rm command to make the command prompt the user with each filename and a ?, before acting on it
Correct Answer: Option C — -i
Detailed Academic Explanation:
In Unix, the rm command is used to remove files or directories. The -i option prompts the user for confirmation before deleting each file. When this option is used, rm will display the filename followed by a question mark (?), and the user needs to confirm by typing 'y' for yes or 'n' for no. So, -i is the option used with the rm command to prompt the user with each filename and a question mark before acting on it.
💡Key Conceptual Anchor:Unix
Question 31 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following directories contain all the Alias created by a user, including his login directory?
Correct Answer: Option E — None of the above
Detailed Academic Explanation:
The correct answer is Option E: None of the above . In Unix, the directory that contains all the aliases created by a user, including their login directory, is typically the user's home directory. By default, aliases are usually stored in a user's configuration files such as .bashrc or .bash_profile located in their home directory. Therefore, None of the above options is the correct directory for storing user aliases.
💡Key Conceptual Anchor:Unix
Question 32 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following commands is used to obtain a list of all files by modification time?
Correct Answer: Option B — ls -t
Detailed Academic Explanation:
In Unix, the ls command is used to list directory contents. The -t option with ls is used to sort files by modification time, showing the most recently modified files first. So, ls -t is the command used to obtain a list of all files sorted by modification time.
💡Key Conceptual Anchor:Unix
Question 33 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
The % key allows you
Correct Answer: Option A — to move the cursor to a matching delimiter, when a delimiters a parenthesis, a bracket, or a brace.
Detailed Academic Explanation:
In Unix terminal environments, the % key, when used with certain text editors like vi or vim, allows the cursor to jump to the matching delimiter (such as parenthesis, bracket, or brace) in the text. This feature helps in navigating through code or text files efficiently, especially in programming or scripting contexts. So, Option A is the correct description of what the % key allows you to do.
💡Key Conceptual Anchor:Unix
Question 34 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to display the characteristics of a process?
Correct Answer: Option C — ps
Detailed Academic Explanation:
In Unix, the ps command is used to display information about active processes. By default, it shows a brief list of processes running in the current terminal session, including their process IDs (PIDs), terminal IDs (TIDs), and other characteristics such as CPU and memory usage. So, ps is the command used to display the characteristics of a process.
💡Key Conceptual Anchor:Unix
Question 35 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following commands is used to identify the type of file by context?
Correct Answer: Option C — file
Detailed Academic Explanation:
In Unix, the file command is used to determine the type of a file by examining its contents and context. When you run file followed by a filename as an argument, it analyzes the file and provides information about its type, such as whether it is a text file, binary file, directory, symbolic link, etc. So, file is the command used to identify the type of file by context.
💡Key Conceptual Anchor:Unix
Question 36 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
The field separator in cut command is specified with
Correct Answer: Option B — -a option
Detailed Academic Explanation:
In Unix, the cut command is used to extract sections from each line of input. The field separator, which specifies how the fields are separated in the input, is specified using the -d option followed by the delimiter character. For example, if you want to use a comma as the field separator, you would use cut -d',' . So, -d option is used to specify the field separator in the cut command.
💡Key Conceptual Anchor:Unix
Question 37 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which of the following options will be used to display number of blocks used by a file?
Correct Answer: Option D — -s
Detailed Academic Explanation:
In Unix, the du command is used to estimate file space usage. The -s option, when used with du , displays only a summary of the disk usage, including the total number of blocks used by a file or directory. So, -s is the option used to display the number of blocks used by a file.
💡Key Conceptual Anchor:Unix
Question 38 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which option will be used with touch command to change the access time?
Correct Answer: Option A — -a
Detailed Academic Explanation:
In Unix, the touch command is used to change file timestamps, including access (atime) and modification (mtime) times. The -a option, when used with touch , updates only the access time of the file to the current time without modifying the file's content. So, -a is the option used with the touch command to change the access time of a file.
💡Key Conceptual Anchor:Unix
Question 39 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to make all files and sub-directories in the directory (progs) executable by all users?
Correct Answer: Option A — chmod -R a+x progs
Detailed Academic Explanation:
In Unix, the chmod command is used to change the permissions of files and directories. The -R option is used to recursively change permissions for the specified directory and its subdirectories. The a+x part of the command grants execute permission to all users (owner, group, and others). So, chmod -R a+x progs makes all files and subdirectories in the progs directory executable by all users. Therefore, Option A is the correct command to achieve the desired task.
💡Key Conceptual Anchor:Unix
Question 40 of 40
★ PPSC
★ FPSC
★ PPSC
★ FPSC
Which command is used to display and create files?
Correct Answer: Option B — vi
Detailed Academic Explanation:
In Unix, the vi command is a text editor that is commonly used to display and create files. It allows users to view and edit text files directly within the terminal. When you open a file with vi that doesn't exist, it creates a new file with that name. So, vi is the command used to both display and create files in Unix.
💡Key Conceptual Anchor:Unix
✓Link copied to clipboard
Continue Your Practice
Advanced Mapreduce Concepts — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.