Unix Questions
Practice Unix MCQs with answers and explanations. Page 5 of 7.
Category
Computer Science
Topic
Unix
Page
5 / 7
Mode
Practice
Questions
Open any question to view the answer and explanation.
Safely removing year-old files with confirmation (Unix find):
Which command removes files (with a user confirmation prompt for each) that have neither been accessed nor modified in the last 365 days under /usr/?
Open
View answer
Viewing the end of a file on Unix/Linux:
Which command displays the tail (last lines) of a text file on the terminal by default?
Open
View answer
Identify your terminal device on Unix/Linux:
Which command prints the device file name (for example, /dev/tty2 or /dev/pts/0) of the terminal session you are currently using?
Open
View answer
Unix file permissions (chmod):
Which command grants execute permission to user, group, and others for every file named 'letter' in the current directory?
Open
View answer
Copying and renaming a file between directories (Unix cp):
Which command copies the file 'wb' from the 'programs' directory to the 'misc' directory, naming the destination file 'wbx'?
Open
View answer
UNIX/Linux file permissions (octal to symbolic):
The command 'chmod 761 note' sets permissions using octal notation. Which equivalent symbolic-mode command applies the same permissions to the file named 'note'?
Open
View answer
UNIX account database fields:
In /etc/passwd (the classic UNIX user account file), what does the 7th field represent?
Open
View answer
vi text editor (Vim/vi classic):
Which vi command replaces the single character under the cursor and then enters insert mode so you can type any number of replacement characters?
Open
View answer
df (disk free) usage:
Which option with the df command includes a grand total of disk space across the listed file systems?
Open
View answer
Granting execute permission (owner only):
Which chmod command gives the file owner execute permission on the file 'note' (without changing other existing permissions)?
Open
View answer
Copying a file between directories on UNIX:
Which command correctly copies the file 'programs/wb' into the directory 'misc' keeping the same name?
Open
View answer
Finding user startup files across the system:
Which find command locates all files named '.profile' anywhere on the system and prints their full paths?
Open
View answer
Setting permissions for all user classes:
Which UNIX command sets permissions on a file by specifying bits for user, group, and others in one operation?
Open
View answer
Recursive deletion:
Which rm command removes all files in the current directory as well as every file and subdirectory within its subdirectories?
Open
View answer
Counting lines, words, and characters:
Which UNIX command reports the number of lines, words, and bytes/characters in a file?
Open
View answer
UNIX/Linux command basics
Which command should you use to create a new directory (folder) from the shell?
Open
View answer
vi editor navigation (current line search)
In the classic vi editor, which motion finds and moves the cursor forward to the first occurrence of a specified character ch on the current line?
Open
View answer
Archiving vs. copying directory trees on UNIX/Linux
Which command is traditionally used to copy directory structures “in and out” of archives and is well suited for whole-tree backups and restores?
Open
View answer
chmod operators (symbolic mode)
Which operator with chmod assigns absolute permissions by setting them exactly (replacing previous bits) for the specified classes?
Open
View answer
vi editor insertion at end of line
In vi, which single-key command appends text at the end of the current line and enters insert mode there?
Open
View answer
Practice smarter
Solve a few questions daily and revisit weak topics regularly to improve accuracy.