Unix Questions
Practice Unix MCQs with answers and explanations. Page 4 of 7.
Category
Computer Science
Topic
Unix
Page
4 / 7
Mode
Practice
Questions
Open any question to view the answer and explanation.
chmod usage: Which option applies a permission change recursively to all files and all subdirectories under a given directory?
Open
View answer
Counting entries with pipes: Which pipeline correctly counts the number of directory entries listed in the current directory, producing one numeric line count?
Open
View answer
Shell wildcards (globbing): Which wildcard pattern matches exactly one character in a filename (for example, file?.txt matches file1.txt but not file10.txt)?
Open
View answer
Listing hidden files: Which ls option displays hidden files (names starting with a dot) together with other files in the current directory?
Open
View answer
UNIX account security: Which system file contains the password aging fields (such as last change, minimum/maximum days, and warning periods) associated with user accounts?
Open
View answer
Unix/Linux shells — changing the current working directory (POSIX/Bourne-compatible shells)
In a POSIX/Bourne-compatible shell environment (sh, bash, ksh, dash), which built-in command is used to change the current working directory of the shell process?
Open
View answer
Shell globbing — change into a directory whose name starts with the letter ‘‘p’’
In a POSIX shell (bash/sh), which command correctly changes the current directory to a directory whose name begins with the letter p (for example, photos, projects), using filename expansion?
Open
View answer
Bourne shell login initialization — which file sets a user’s environment on login?
In the classic Bourne shell and Bourne-compatible shells, which file in the user’s HOME directory is executed to initialize the environment at login?
Open
View answer
Understanding chmod — mapping symbolic to octal permissions
What is the octal equivalent of the command: chmod ugo+rw note (i.e., give read and write to user, group, and others on the file ‘‘note’’)?
Open
View answer
Assigning specific permissions with chmod — rwx for owner, rw for group, x for others (file ‘‘note’’)
Which chmod command sets: owner = read+write+execute, group = read+write, others = execute only?
Open
View answer
Octal basics — owner has read and write only
If a file has read and write permissions for the owner (no execute), what is the single octal digit representing the owner’s permissions?
Open
View answer
Finding your current login identity — classic Unix commands
Which command prints information about the current login (user and terminal) in a traditional Unix environment?
Open
View answer
Renaming or moving files in Unix — choose the correct command
Which command is used on Unix/Linux to rename a file (and more generally to move a file to a new path or name)?
Open
View answer
Interpreting long listings — what does ‘‘ls -l’’ tell you?
When you run ls -l on Unix/Linux, which of the following information is displayed for each file entry?
Open
View answer
vi/vim editor — overstriking text on a whole line (Replace mode)
In the classic vi editor (command mode), which single key starts Replace mode so that your typing overwrites existing text (useful when you want to overstrike an entire line from the cursor onward)?
Open
View answer
vi editor set options (Unix/Linux):
In the vi editor, which :set option should be enabled so that searches ignore letter case (for example, 'abc' matches 'ABC') when finding patterns?
Open
View answer
POSIX/Unix filenames and validity:
Which of the following is an invalid filename on a typical Unix-like system (plain files in a standard directory, not including reserved names)?
Open
View answer
Viewing text in pages on Unix systems:
Which command shows a file interactively 24 lines at a time (default page size), allowing forward movement through the content?
Open
View answer
Disk usage summary on Unix/Linux:
Which command is used to summarize per-file and per-directory disk space consumption for quick assessment?
Open
View answer
Printing files on Unix (System V/BSD style):
Which command is commonly used to send a file to the system's print spooler for printing?
Open
View answer
Practice smarter
Solve a few questions daily and revisit weak topics regularly to improve accuracy.