Unix Questions
Practice Unix MCQs with answers and explanations. Page 6 of 7.
Category
Computer Science
Topic
Unix
Page
6 / 7
Mode
Practice
Questions
Open any question to view the answer and explanation.
Copying files in UNIX/Linux
Which command copies a regular file (and, with flags, can also copy directories)?
Open
View answer
chmod practice (symbolic mode example)
For a file named note, which command removes execute permission from the user (owner) and grants read permission to the group and others?
Open
View answer
Removing files on UNIX/Linux
Which standard command removes one or more files from the filesystem?
Open
View answer
Creating links in UNIX/Linux filesystems
Which command is used to create links (hard or symbolic) between files or paths?
Open
View answer
vi editor modes: identifying a non–input command
Which of the following is <em>not</em> an input-mode command in vi (i.e., it does not enter insert/replace input)?
Open
View answer
UNIX/Linux shell usage: Which command saves the output of the who command into a file named user.lst while simultaneously displaying the same output on the terminal?
Open
View answer
UNIX login initialization: Which per-user startup file contains shell instructions that are executed automatically when a user logs in (for Bourne/POSIX-compatible shells)?
Open
View answer
UNIX file permissions: Which chmod command sets read-only permission for all categories (user, group, and others) on a file named note, removing any write or execute rights?
Open
View answer
UNIX permission bits (octal): For a mode of 652 (owner=6, group=5, others=2), which statement is true about the resulting permissions?
Open
View answer
UNIX basics: Which command removes (deletes) an empty directory from the filesystem?
Open
View answer
UNIX utilities: What is the primary purpose of the cat command when used on a regular text file?
Open
View answer
Shell globbing: Which wildcard matches any number of characters (including zero characters) when expanding filenames in a POSIX shell?
Open
View answer
UNIX reminders: Which command provides a simple automatic reminder service that emails upcoming events listed in a user’s calendar file?
Open
View answer
grep regular expressions: Which pattern anchors a match to the end of a line so that only lines ending with the text “pat” are selected?
Open
View answer
Interpreting permission triplets: In a long listing, the first permission triplet shows “rw-” for the owner. What does this indicate about the owner’s access rights on that file?
Open
View answer
vi/vim navigation — moving the cursor left
In the classic vi (and vim in normal mode), which single-key motion command moves the cursor one character to the left?
Open
View answer
vi/vim navigation — scroll half a page backward (up)
In vi/vim normal mode, which control-key command scrolls the screen up by half a page (i.e., a half-page backward)?
Open
View answer
Unix cmp utility — report differing byte numbers and values in octal
Which cmp option produces a detailed list of each differing byte position along with the differing byte values in octal for two files being compared?
Open
View answer
Changing to your home directory in Unix shells
Which command returns the current shell to the user's home directory using the standard POSIX behavior?
Open
View answer
vi/vim editing — delete the character under the cursor
In vi/vim normal mode, which command deletes the single character directly beneath (under) the cursor?
Open
View answer
Practice smarter
Solve a few questions daily and revisit weak topics regularly to improve accuracy.