Courseiva

CCNA Finding Your Way On A Linux System Questions

65 questions · Finding Your Way On A Linux System topic · All types, answers revealed

1
MCQeasy

To navigate from your current directory to your home directory regardless of your current location, which command is most efficient?

A.cd ..
B.cd ~
C.cd /
D.cd /home
AnswerB

The tilde expands to the value of $HOME, so `cd ~` resolves to your home directory from any working directory in a single step. This satisfies the stem's "regardless of your current location" constraint without needing an absolute path or multiple commands.

Why this answer

The 'cd ~' command navigates directly to the current user's home directory from any location. The tilde (~) is a shell expansion that represents the home directory path, making it the most efficient and location-independent way to return home. 'cd' alone also works, but 'cd ~' is explicit and universally correct.

Exam trap

The trap is confusing the root directory (/) with the home directory (~) — candidates may pick 'cd /' thinking it goes home, but it actually goes to the filesystem root.

How to eliminate wrong answers

Option A is wrong because 'cd ..' moves up one directory level, not to the home directory, and its effect depends on the current location. Option C is wrong because 'cd /' changes to the root directory, not the home directory. Option D is wrong because 'cd /home' changes to the /home directory, which is the parent of user home directories, not the user's own home directory.

2
MCQhard

You are searching for a command that deals with 'groups' and want to see all manual pages that mention this term. Which command is most appropriate?

A.apropos groups
B.whatis groups
C.info groups
D.man -a groups
AnswerA

apropos searches the manual page name and short descriptions for a keyword, returning every page mentioning 'groups' across sections. Unlike man -k alternatives or locate, it queries the whatis database directly, satisfying the requirement to see all manual pages referencing the term.

Why this answer

The 'apropos' command searches the manual page names and short descriptions for a keyword, making it the correct tool to find all man pages that mention 'groups'. It is equivalent to 'man -k groups'. This allows the user to discover commands related to groups, such as 'groupadd', 'groupdel', etc.

Exam trap

The trap here is confusing 'apropos' with 'whatis' or 'man -a'; candidates may think 'whatis' searches broadly, but it only provides a short description for a specific command.

How to eliminate wrong answers

Option B is wrong because 'whatis groups' displays a one-line summary for the exact command 'groups' only, not all pages mentioning the term. Option C is wrong because 'info groups' opens the info documentation for the 'groups' command specifically, not a search across all manuals. Option D is wrong because 'man -a groups' displays all man pages named 'groups' in sequence, but does not search for the term across all manual pages.

3
MCQmedium

What does the 'cat' command do when provided with multiple filenames as arguments?

A.It displays only the first file
B.It displays the contents of all files sequentially
C.It compares them
D.It merges them into one file
AnswerB

Concatenating multiple filenames makes `cat` read each file in the order given and write their contents to standard output without separation, so the files appear joined end-to-end. This directly satisfies the stem's requirement for handling several arguments at once, rather than processing only the first.

Why this answer

When cat is given multiple filenames, it reads each file in the order listed and writes their contents to standard output sequentially, effectively concatenating them. This is the core behavior that gives the command its name (concatenate).

Exam trap

The trap is assuming cat merges files into a new file by default; candidates forget that redirection (>) is required to actually create a merged file, and pick option D.

How to eliminate wrong answers

Option A is wrong because cat does not stop after the first file — it processes every argument in sequence. Option C is wrong because cat does not compare files; that is the job of diff or cmp. Option D is wrong because cat only merges files into one if you redirect the output (e.g., cat a b > c); by itself it just prints to stdout and does not create or modify a file.

4
Multi-Selecthard

Which THREE of the following commands are used for file manipulation?

Select 3 answers
A.cp
B.man
C.pwd
D.rm
E.mv
AnswersA, D, E

The `cp` command copies files and directories, directly satisfying the file manipulation requirement. Unlike viewing commands such as `cat` or `less`, which only read content, `cp` creates new filesystem entries, altering stored data. This write operation places it firmly among the manipulation utilities the question seeks.

Why this answer

The three commands used for file manipulation are cp, rm, and mv. Option A, cp, is correct because it copies files and directories from a source to a destination, creating new file content at the target path. Option D, rm, is correct because it removes (deletes) files and, with options like -r, directories from the filesystem.

Option E, mv, is correct because it moves or renames files and directories, changing their location or name within the filesystem. The unmarked options do not belong: man (B) displays manual pages for commands, and pwd (C) prints the current working directory path, so neither performs file manipulation.

Exam trap

The trap is that candidates see familiar commands like pwd and man and assume any command typed at the shell counts as 'file manipulation' — the exam expects you to distinguish commands that modify files from those that merely report or document.

5
MCQhard

You need to see the last 20 lines of a file named 'access.log'. Which command is the most appropriate?

A.cat -n 20 access.log
B.less -n 20 access.log
C.head -n 20 access.log
D.tail -n 20 access.log
AnswerD

`tail -n 20 access.log` reads only the final 20 lines, satisfying the stem's requirement to view the last 20 lines without loading the whole file. Unlike `head`, which prints from the start, `tail` counts backwards from the end, making it the precise tool for this task.

Why this answer

tail -n 20 access.log prints the last 20 lines of the file, which is exactly what is needed to inspect recent log entries. The -n option specifies the number of lines, and tail reads from the end of the file, making it ideal for logs where the newest events are appended at the bottom.

Exam trap

The trap is mixing up head and tail — candidates under time pressure may read 'last 20 lines' and still select head because both commands share the -n syntax, so always confirm direction (first vs. last).

How to eliminate wrong answers

Option A (cat -n 20 access.log) is wrong because cat's -n option numbers all output lines; '20' would be interpreted as a filename, producing an error, and cat would still print the entire file. Option B (less -n 20 access.log) is wrong because less's -n option suppresses line numbers rather than limiting output, and less is a pager that shows the file from the beginning. Option C (head -n 20 access.log) is wrong because head prints the first 20 lines, the opposite of what is required for viewing the most recent log entries.

6
MCQmedium

You want to delete a file but you are worried about accidentally deleting the wrong one. Which flag should you use with 'rm' for confirmation?

A.rm -f
B.rm -v
C.rm -i
D.rm -R
AnswerC

The -i flag makes rm prompt interactively before removing each file, letting you confirm or decline deletion. This satisfies the requirement to avoid accidentally deleting the wrong file, since removal only proceeds after explicit confirmation.

Why this answer

The -i flag on rm stands for 'interactive' and prompts the user for confirmation before deleting each file. This is exactly the safeguard needed when you want to avoid accidentally removing the wrong file.

Exam trap

The trap is conflating -f (force, no prompt) with -i (interactive, prompt) — candidates who assume 'f' means 'friendly' or 'safe' pick the wrong flag.

How to eliminate wrong answers

Option A is wrong because rm -f forces deletion without any prompt, which is the opposite of what is needed for safety. Option B is wrong because rm -v enables verbose output, showing what was deleted, but it does not ask for confirmation. Option D is wrong because rm -R (or -r) enables recursive deletion of directories and their contents; it does not add a confirmation prompt and is actually more dangerous.

7
Multi-Selecthard

Which TWO of the following are valid ways to search for files?

Select 2 answers
A.man
B.cat
C.find
D.grep
E.locate
AnswersC, E

The find command traverses directory trees recursively, locating files by name, type, size, permissions or timestamps. It is a valid command-line search method, satisfying the question's requirement for legitimate ways to search for files on a Linux system.

Why this answer

Option C, find, is correct because it is the standard Linux/Unix command for searching the filesystem for files by name, path, size, permissions, timestamps, and other attributes (e.g., find / -name "*.conf"). Option E, locate, is correct because it searches a prebuilt filename database (typically /var/lib/mlocate/mlocate.db, updated by updatedb) and returns matching file paths quickly. Option A, man, is not a file-search tool; it displays manual pages for commands.

Option B, cat, is used to concatenate and display file contents, not to search for files. Option D, grep, searches for text patterns inside file contents rather than locating files themselves.

Exam trap

The trap is confusing filename search with content search — candidates often pick `grep` because it 'searches,' but grep searches inside files, not for files themselves.

8
MCQhard

A user needs to view the first few lines of a large log file to confirm its format before processing it. Which command displays the beginning of the file by default?

A.head /var/log/syslog
B.tail /var/log/syslog
C.less /var/log/syslog
D.cat /var/log/syslog
AnswerA

'head' displays the first ten lines of a file by default, which is exactly what is needed to view the beginning and confirm the format. It is the standard counterpart to 'tail' and can be adjusted with '-n' to show a different number of lines. This directly meets the requirement.

Why this answer

The 'head' command prints the first ten lines of a file by default, making it ideal for quickly inspecting the start of a large log to verify its format. The 'tail' command shows the end, 'cat' dumps the whole file, and 'less' opens an interactive pager, so none of them matches the simple default behavior requested.

Exam trap

The trap here is confusing 'head' and 'tail', which show opposite ends of a file despite having similar names.

9
MCQmedium

A support technician must read a very large log file, /var/log/messages, and only wants the portion that begins with the line containing the timestamp 'Mar 14 09:15' and continues to the end of the file. Which command should the technician run?

A.grep -c 'Mar 14 09:15' /var/log/messages
B.sed -n '/Mar 14 09:15/,$p' /var/log/messages
C.tail -n 50 /var/log/messages
D.head -n 50 /var/log/messages
AnswerB

The sed range address starts at the first line matching the timestamp pattern and the $ address extends the range to the last line of the file. The -n flag suppresses automatic printing, and the p command prints only the selected range, which is exactly the requested section.

Why this answer

Stream editors such as sed can select a range defined by a pattern and a terminating address. Using the timestamp as the starting address and the end-of-file symbol as the closing address prints precisely the tail portion that begins at the matching line, which is what the technician needs when the log is too large to page through manually.

Exam trap

The trap here is reaching for tail with a line count when the real requirement is to start at a pattern match rather than at a fixed number of lines from the end.

10
MCQeasy

A new user wants to display the contents of the file /etc/hostname on the terminal. Which command will print the file's contents to standard output?

A.file /etc/hostname
B.touch /etc/hostname
C.cat /etc/hostname
D.chmod /etc/hostname
AnswerC

The cat command concatenates and writes file contents to standard output, so running it on /etc/hostname prints the hostname to the terminal. This is the simplest and most direct way to display a small text file's contents as requested.

Why this answer

Displaying a text file's contents on the terminal is the primary purpose of cat, which reads the file and writes it to standard output. The touch command manages timestamps and empty files, chmod alters permissions, and file identifies a file's type. Only cat outputs the actual data contained in /etc/hostname.

Exam trap

The trap here is that file sounds like it should show file contents, but it only reports the file type, not the data inside.

11
MCQhard

A user wants to create a symbolic link named latest.conf in the current directory that points to /etc/app/versions/v2.conf. Which command creates this link correctly?

A.ln -s latest.conf /etc/app/versions/v2.conf
B.ln -s /etc/app/versions/v2.conf latest.conf
C.ln /etc/app/versions/v2.conf latest.conf
D.ln -h /etc/app/versions/v2.conf latest.conf
AnswerB

The ln command creates links, and -s selects a symbolic link instead of a hard link. The first pathname is the target and the second is the new link name, so this invocation creates latest.conf in the current directory pointing at the absolute path /etc/app/versions/v2.conf, which remains valid from any working directory.

Why this answer

Creating a symbolic link requires the -s option, and the argument order is target first, link name second. Using the absolute target path makes the link resolve correctly regardless of the directory from which it is later accessed. Omitting -s yields a hard link, reversing the arguments misplaces the link, and -h does not select symbolic link creation.

Exam trap

The trap here is reversing the target and link-name arguments or forgetting -s, which silently produces a hard link instead of a symbolic one.

12
Multi-Selecthard

A Linux administrator is working in a directory with many files and wants to identify files by their type and permissions without opening them. Which TWO commands can provide this information? (Choose two.)

Select 2 answers
A.stat
B.cat
C.ls -l
D.file
E.less
AnswersC, D

ls -l lists files in long format, showing permissions, number of links, owner, group, size, and modification time. This directly reveals file type through the first character (e.g., - for regular file, d for directory, l for symlink) and permissions through the rwx string. It satisfies the requirement to identify type and permissions without opening files.

Why this answer

To identify file type and permissions without opening files, ls -l provides permissions and type indicators, while file determines the content type. Together they cover both needs. cat and less open file contents, which is not desired, and stat focuses on metadata like permissions but does not classify content type as file does. Thus, ls -l and file are the two appropriate commands.

Exam trap

The trap here is assuming stat is equivalent to file for type detection, when stat only shows mode bits and not content-based file type classification.

13
Multi-Selecteasy

Which TWO of the following commands can be used to display the contents of a text file?

Select 2 answers
A.cd
B.mkdir
C.cat
D.less
E.mv
AnswersC, D

`cat` concatenates files and writes them to standard output, so passing a single filename prints that file's entire contents to the terminal. This directly satisfies the stem's requirement to display a text file's contents, and it is one of the two commands the question expects.

Why this answer

Option C, cat, is correct because the cat command concatenates and prints file contents directly to standard output, making it the standard way to display a text file's contents. Option D, less, is correct because it is a pager that displays a text file's contents one screen at a time, allowing scrolling and searching through the file. The unmarked options do not belong: cd changes the current working directory, mkdir creates a new directory, and mv moves or renames files or directories—none of these display file contents.

Exam trap

The trap is that multiple commands touch files (mv, mkdir, cd), so candidates must distinguish commands that display content from those that manipulate filesystem structure or location.

14
MCQmedium

When using the 'man' command, how do you navigate to the next page of the manual entry?

A.Enter
B.Page Up
C.Right Arrow
D.Spacebar
AnswerD

Pressing the spacebar advances the pager one full screen, satisfying the requirement to reach the next page of a manual entry. The `man` command pipes output through a pager such as `less`, where Space scrolls forward a page, whereas Enter moves a single line.

Why this answer

The 'man' command uses the 'less' pager by default, and in 'less', pressing the Spacebar scrolls forward by one full page. This is a standard navigation convention in Unix pagers, allowing quick reading of long manual pages. The Spacebar is the correct key to advance to the next page of the manual entry.

Exam trap

The trap here is confusing the Spacebar with the Enter key or Page Down, as many candidates assume Enter advances a page, but in 'less' it only scrolls one line.

How to eliminate wrong answers

Option A is wrong because the Enter key scrolls forward by only one line, not a full page. Option B is wrong because Page Up scrolls backward, not forward. Option C is wrong because the Right Arrow scrolls horizontally to the right, which is useful for long lines but does not navigate pages vertically.

15
Multi-Selectmedium

Which THREE of the following represent ways to refer to the home directory?

Select 3 answers
A.~
B...
C.$HOME
D./home/user
E./
AnswersA, C, D

The tilde character is expanded by the shell to the current user's home directory path, so `cd ~` or `ls ~/docs` resolves correctly. It satisfies the stem because it is a shell-level shorthand, distinct from the environment variable and the literal path forms.

Why this answer

Option A (~) is correct because the tilde is the shell's standard shorthand for the current user's home directory, expanded by the shell before command execution. Option C ($HOME) is correct because HOME is the environment variable that stores the absolute path of the current user's home directory, and referencing $HOME resolves to that path. Option D (/home/user) is correct because on typical Linux systems the home directory for a user named 'user' is literally located at /home/user, making it a valid absolute path reference.

Option B (..) is not correct because it refers to the parent directory of the current working directory, not the home directory. Option E (/) is not correct because it denotes the root of the filesystem, which is distinct from a user's home directory.

Exam trap

The trap here is confusing the home directory with the root directory or parent directory. Candidates might think '..' or '/' refer to home, but they do not.

16
MCQhard

A user is in /home/bob and wants to copy the file notes.txt from /data/reports into the current directory, keeping the same filename. Which command performs this operation?

A.cp /data/reports/notes.txt .
B.cp . /data/reports/notes.txt
C.mv /data/reports/notes.txt .
D.cp -r /data/reports/notes.txt /home/bob
AnswerA

The cp command takes a source followed by a destination. The single dot denotes the current working directory, /home/bob, so this copies the source file into it while preserving the name notes.txt. This is the standard, unambiguous way to copy a file into the directory the user is currently in.

Why this answer

Copying a file into the current directory is expressed with cp source . where the dot stands for the working directory. The copy leaves the original intact in /data/reports and creates notes.txt in /home/bob. Moving the file, reversing the operands, or using a recursive option for a single regular file all fail to match the stated requirement.

Exam trap

The trap here is confusing mv with cp, since both accept a source and destination and both appear to place a file where the user wants it.

17
MCQmedium

You want to delete a directory named 'temp_backup' that contains several files. Which command will successfully remove it and its contents?

A.rm -r temp_backup
B.rm temp_backup
C.rmdir temp_backup
D.rm -f temp_backup
AnswerA

The `-r` flag makes `rm` recurse into the directory, deleting its files and subdirectories before removing `temp_backup` itself. Without it, `rm` refuses to act on directories. This satisfies the stem's requirement to remove a non-empty directory and all its contents in one command.

Why this answer

`rm -r temp_backup` recursively removes the directory and all its contents, which is required because `rm` by default refuses to delete directories. The -r (recursive) flag descends into subdirectories and deletes files before removing the directory itself. This is the standard way to delete a non-empty directory.

Exam trap

The trap is choosing `rmdir` (which sounds like 'remove directory') or `rm -f` (which sounds forceful) — 010-160 tests whether you know that only -r enables recursive directory deletion.

How to eliminate wrong answers

Option B is wrong because `rm temp_backup` without -r fails with 'cannot remove: Is a directory' — rm does not delete directories by default. Option C is wrong because `rmdir temp_backup` only removes empty directories and will fail with 'Directory not empty' when files are present. Option D is wrong because `rm -f temp_backup` forces removal without prompting but still does not recurse into directories — it will still fail on a directory.

18
MCQeasy

A user wants to see the manual page for the 'passwd' command, but is unsure which section contains the command documentation. Which command displays the manual page for 'passwd' from section 1?

A.man -k passwd
B.man 5 passwd
C.man 1 passwd
D.man -f passwd
AnswerC

The syntax 'man 1 passwd' explicitly requests section 1 of the manual, which contains user commands. Since 'passwd' exists in multiple sections, specifying the section number ensures the command documentation is displayed rather than the file format or other entries, directly satisfying the user's need.

Why this answer

Manual pages are organized into numbered sections, and section 1 holds user commands. Because 'passwd' also appears in section 5 as a file format, explicitly specifying section 1 with 'man 1 passwd' guarantees the command documentation is shown, which is exactly what the user requested.

Exam trap

The trap here is forgetting that the same manual page name can exist in multiple sections, so omitting the section number may open the wrong page.

19
MCQmedium

How do you rename a file named 'oldname' to 'newname' using the command line?

A.rn oldname newname
B.ren oldname newname
C.cp oldname newname
D.mv oldname newname
AnswerD

The `mv` command renames a file when both arguments are paths in the same directory, moving the source to the destination name without copying data. This satisfies the stem's requirement to rename 'oldname' to 'newname' in a single command-line operation, unlike `cp`, which duplicates the file.

Why this answer

The 'mv' command moves or renames files; when the source and destination are in the same directory, it effectively renames the file. Running 'mv oldname newname' renames oldname to newname in place, preserving the inode and all file attributes. This is the standard POSIX way to rename files on Linux and Unix systems.

Exam trap

The trap is picking 'cp' as a rename, forgetting that cp leaves the original file in place — only mv removes the old name and assigns the new one.

How to eliminate wrong answers

Option A is wrong because 'rn' is not a standard Linux command — it does not exist in default shells and would return 'command not found'. Option B is wrong because 'ren' is a Windows/DOS command, not a Linux command; Linux uses mv for renaming. Option C is wrong because 'cp oldname newname' creates a copy and leaves the original file intact, which is not a rename — the original still exists under its old name.

20
MCQeasy

Which command is used to clear the terminal screen?

A.clean
B.clear
C.wipe
D.reset
AnswerB

The `clear` command writes the terminal's terminfo capability to erase the visible screen and relocate the cursor to the top-left, satisfying the requirement to clear the terminal display. It operates on the terminal emulator's buffer directly, unlike commands that merely scroll existing output out of view.

Why this answer

The `clear` command is the standard Unix/Linux utility that clears the terminal screen by sending the appropriate escape sequence (typically `\033[H\033[2J` or `\033[3J`) to the terminal emulator. It is part of the ncurses package and works by consulting the `TERM` environment variable to determine the correct control characters for the current terminal type. This makes it the correct and portable choice for clearing the screen in a shell session.

Exam trap

The trap here is confusing `clear` with `reset` or assuming that `clean` or `wipe` are standard screen-clearing commands; candidates may pick `reset` because it also clears the screen, but the question asks for the command specifically used to clear the terminal screen, which is `clear`.

How to eliminate wrong answers

Option A is wrong because `clean` is not a standard Linux command for clearing the screen; it is typically a custom script or an unrelated utility (e.g., in some build systems) and does not perform terminal clearing. Option C is wrong because `wipe` is a secure file deletion tool (from the `wipe` package) that overwrites file contents, not a screen-clearing command. Option D is wrong because `reset` reinitializes the terminal, resetting its state and clearing the screen as a side effect, but its primary purpose is to recover a garbled terminal, not simply to clear the screen; it is heavier and not the intended command for routine screen clearing.

21
MCQeasy

Which shell variable typically contains the directories searched for command executables?

A.$SHELL
B.$USER
C.$PATH
D.$HOME
AnswerC

$PATH holds a colon-separated list of directories the shell searches, in order, when resolving a bare command name. This directly satisfies the stem: it is the variable consulted to locate command executables, so editing it changes which binary runs.

Why this answer

The $PATH environment variable holds a colon-separated list of directories that the shell searches, in order, when you type a command without a path. It is the standard mechanism for locating executables like ls, grep, or custom scripts.

Exam trap

The trap is mixing up common environment variables — candidates may pick $SHELL or $HOME because they relate to the shell environment, but only $PATH controls executable lookup.

How to eliminate wrong answers

Option A is wrong because $SHELL stores the path to the user's default login shell (e.g., /bin/bash), not the executable search path. Option B is wrong because $USER contains the current username, used for prompts and scripts, not command lookup. Option D is wrong because $HOME points to the user's home directory (e.g., /home/alice), which is unrelated to where the shell looks for binaries.

22
MCQhard

You need to move a file named 'data.txt' from the current directory to '/var/logs' but want to be prompted if a file with the same name already exists in the destination. Which option should you add to 'mv'?

A.mv -i
B.mv -n
C.mv -f
D.mv -v
AnswerA

The -i flag puts mv into interactive mode, prompting for confirmation before overwriting an existing destination file. This directly satisfies the stem's constraint of being warned when a file of the same name already exists in /var/logs, preventing accidental data loss.

Why this answer

The 'mv -i' option enables interactive mode, prompting the user for confirmation before overwriting an existing file in the destination. This directly satisfies the requirement to be prompted if a file with the same name already exists. Without -i, mv silently overwrites by default.

Exam trap

The trap is confusing -i (interactive prompt) with -n (no-clobber, silent skip) — both prevent overwriting but only -i prompts the user, which is the specific requirement here.

How to eliminate wrong answers

Option B is wrong because 'mv -n' (no-clobber) silently skips overwriting without prompting — it does not ask for confirmation. Option C is wrong because 'mv -f' (force) removes the destination file without prompting, the opposite of what is needed. Option D is wrong because 'mv -v' (verbose) only prints what is being done; it does not prompt before overwriting.

23
MCQmedium

You are in the directory '/home/alex/projects' and want to switch to the parent directory of your current location using a relative path. Which command accomplishes this?

A.cd /
B.cd .
C.cd ..
D.cd ~
AnswerC

The double dot represents the parent directory in a relative path. Running 'cd ..' from '/home/alex/projects' moves you up one level to '/home/alex'. This directly satisfies the requirement to switch to the parent directory using a relative path, without needing an absolute path.

Why this answer

In relative path notation, '..' denotes the parent directory. Executing 'cd ..' from '/home/alex/projects' changes the working directory to '/home/alex', which is exactly the parent of the current location. The other options either stay in place, jump to root, or jump to the home directory.

Exam trap

The trap here is mixing up the single dot, which means the current directory, with the double dot, which means the parent directory.

24
Multi-Selecteasy

Which TWO of the following are valid ways to get help on a Linux system?

Select 2 answers
A.search
B.man
C.findhelp
D.help
E.explain
AnswersB, D

The man command displays the system's reference manual pages, giving authoritative documentation for commands, configuration files and system calls. It satisfies the stem's requirement for a valid way to obtain help on a Linux system.

Why this answer

Option B, `man`, is correct because the manual page system is the standard Linux documentation interface, invoked as `man <command>` to display the reference manual for a command, system call, or configuration file. Option D, `help`, is correct because it is a valid built-in command in shells like Bash that prints usage information for shell built-ins (e.g., `help cd`), and it also appears as a common `--help` option on many utilities. The other options are not valid Linux help mechanisms: `search` is not a help command (it resembles Windows' `search` or unrelated tools), `findhelp` is not a standard Linux command, and `explain` is not a Linux help utility.

Exam trap

The trap is assuming that any plausible-sounding word ('search', 'findhelp', 'explain') is a real Linux command — the exam tests whether you know the actual standard tools: 'man', 'info', 'help', and '--help'.

25
Multi-Selectmedium

Which TWO of the following commands help you move within the directory structure?

Select 2 answers
A.cat
B.ls
C.cd
D.mv
E.popd
AnswersC, E

The cd built-in changes the shell's current working directory, which is precisely the act of moving within the directory structure. It accepts absolute paths, relative paths, .., and ~, satisfying the stem's requirement for navigation rather than file listing or content display.

Why this answer

Option C, cd, is correct because it is the shell built-in that changes the current working directory, allowing you to move up, down, or across the directory tree (e.g., cd /var/log or cd ..). Option E, popd, is correct because it removes the top entry from the directory stack and changes the current working directory to the newly exposed directory, effectively moving you within the directory structure. Option A, cat, is wrong because it concatenates and displays file contents rather than changing your location.

Option B, ls, is wrong because it only lists directory contents without changing the working directory. Option D, mv, is wrong because it moves or renames files and directories, not the shell's current working directory.

Exam trap

The trap is confusing file-manipulation commands (mv, cat) with directory-navigation commands (cd, popd) — candidates who think mv 'moves you' pick the wrong answer.

26
Multi-Selectmedium

Which THREE of the following commands are used for viewing file metadata or status?

Select 3 answers
A.ls -l
B.stat
C.file
D.cat
E.cd
AnswersA, B, C

`ls -l` satisfies the metadata-viewing requirement by reading directory entries and printing each file's inode attributes: permission bits, hard-link count, owner, group, byte size, and modification timestamp. This long-format listing exposes exactly the status fields the stem requests, unlike plain `ls`, which shows only names.

Why this answer

Option A, `ls -l`, is correct because the long-listing format displays file metadata such as permissions, hard-link count, owner, group, size, and modification timestamp for each file. Option B, `stat`, is correct because it explicitly reports file status/metadata including inode number, size, block count, access/modify/change times, and device information. Option C, `file`, is correct because it inspects file content and reports the file type (e.g., ASCII text, ELF binary, directory), which is file status information.

Option D, `cat`, is not correct because it concatenates and prints file contents rather than showing metadata. Option E, `cd`, is not correct because it changes the shell's current working directory and displays no file metadata or status.

Exam trap

The trap here is confusing commands that display file *contents* (cat, less, head) with commands that display file *metadata* (ls -l, stat, file) — candidates often pick cat because it 'shows the file'.

27
MCQeasy

A user named alice is working in /home/alice/projects and wants to navigate to the parent directory of her current location. Which command should she execute?

A.cd ..
B.cd ~
C.cd /
D.cd -
AnswerA

The special directory entry '..' always refers to the parent of the current directory, so running cd .. from /home/alice/projects moves alice up one level to /home/alice. This is the standard, portable way to move to the parent directory in any POSIX-compliant shell, and it does not depend on knowing the absolute path.

Why this answer

The parent directory is represented by the special entry '..', which exists in every directory on a Linux filesystem. Issuing cd .. from /home/alice/projects therefore moves the shell's working directory to /home/alice. The other commands change to different locations: the previous directory, the home directory, or the filesystem root, none of which specifically means 'one level up'.

Exam trap

The trap here is confusing the tilde, which expands to the home directory, with the double-dot entry, which denotes the parent directory.

28
Multi-Selecteasy

Which THREE of the following are components of a standard Linux file path?

Select 3 answers
A.Root directory (/)
B.Terminal color
C.User password
D.Directory names
E.Filename
AnswersA, D, E

The root directory (/) anchors every absolute Linux path, acting as the topmost node from which all other directories descend. Since the question asks for components of a standard file path, the root satisfies this directly: every absolute path begins at /, making it an essential structural element.

Why this answer

A standard Linux file path is built from a starting point and a sequence of names that lead to a target. Option A, the root directory (/), is correct because every absolute path begins at the filesystem root, which is the top of the directory hierarchy. Option D, directory names, is correct because intermediate path components are directory names separated by forward slashes (e.g., /usr/bin), and each names a directory traversed along the way.

Option E, the filename, is correct because the final component of a path identifies the target file (or directory) itself, such as /etc/hosts. The unmarked options do not belong: terminal color (B) is a display/terminal-emulator setting unrelated to path syntax, and a user password (C) is authentication data stored in files like /etc/shadow, not a component of a path.

Exam trap

The trap here is confusing filesystem path syntax with unrelated shell or terminal settings (like color), causing candidates to select non-path items such as terminal color or passwords.

29
MCQmedium

A user is in '/var/log' and wants to copy the file 'app.log' to '/tmp/archive' while preserving its original permissions, ownership, and timestamps. Which command accomplishes this?

A.mv -a app.log /tmp/archive/
B.cp -a app.log /tmp/archive/
C.cp app.log /tmp/archive/
D.ln -s app.log /tmp/archive/
AnswerB

The -a (archive) option to cp enables recursive copying while preserving mode, ownership, timestamps, and other metadata, effectively combining -dR --preserve=all. Copying a single file with cp -a app.log /tmp/archive/ retains the original attributes, exactly matching the requirement. This is the standard way to duplicate files without losing metadata.

Why this answer

Preserving permissions, ownership, and timestamps during a copy requires cp with the archive option, which bundles recursive copying and full attribute preservation. A plain copy resets attributes, moving removes the source, and creating a symbolic link does not duplicate data. Only the archive-mode copy produces an independent file with metadata intact.

Exam trap

The trap here is believing a basic cp automatically retains ownership and timestamps instead of applying umask-based defaults.

30
MCQeasy

You are browsing a directory and need to see hidden files alongside regular files. Which command achieves this?

A.ls -R
B.ls -h
C.ls -a
D.ls -l
AnswerC

The -a flag makes ls list all entries, including dotfiles such as .bashrc and .gitignore that are hidden by default. This directly satisfies the stem's requirement to view hidden files alongside regular ones within the current directory listing.

Why this answer

The 'ls -a' command lists all directory entries, including hidden files (those whose names begin with a dot, like .bashrc or .gitignore). This is the standard way to reveal hidden files alongside regular ones.

Exam trap

The trap is confusing ls flags that sound similar — candidates may pick -l thinking 'long listing shows everything' or -R thinking 'recursive includes hidden', but only -a (or -A) reveals dotfiles.

How to eliminate wrong answers

Option A is wrong because 'ls -R' recursively lists subdirectories but does not show hidden files unless combined with -a. Option B is wrong because 'ls -h' enables human-readable sizes (e.g., 1K, 234M) and has nothing to do with hidden files. Option D is wrong because 'ls -l' produces a long-format listing with permissions, owner, size, and date, but still omits hidden files by default.

31
MCQmedium

A junior administrator is troubleshooting a script and needs to know the exact location of the executable that runs when the command 'grep' is typed, without executing it. Which command should be used?

A.locate grep
B.whereis grep
C.which grep
D.find / -name grep
AnswerC

The which command searches the directories listed in the PATH environment variable and prints the full path of the executable that would be run when the command is invoked. This directly answers the administrator's need to know the exact location without executing the command, and it respects the current shell's PATH order, making it the most appropriate choice.

Why this answer

The which command is designed to locate a command's executable by searching the directories in the PATH environment variable in order, returning the first match that would be executed. This directly addresses the need to identify the exact binary without running it, and it respects the shell's command resolution behavior, unlike broader search tools that may return multiple or irrelevant results.

Exam trap

The trap here is assuming that any file-finding command will reveal the executable that the shell actually uses, when only which respects PATH order and resolves the command as the shell would.

32
MCQmedium

You have created a script but it is not executable. Which command should you use to give the owner execute permissions?

A.chown u+x
B.chgrp u+x
C.chmod u+x
D.chperm u+x
AnswerC

`chmod u+x` adds execute permission for the file's owner only, using the symbolic `u` (user) class and `+x` to grant execution. This directly satisfies the stem's constraint of giving the owner execute rights without altering group or other permissions, unlike numeric modes such as `755` that also widen access.

Why this answer

The 'chmod u+x' command adds execute permission for the user (owner) of the file. 'chmod' is the correct command to change file mode bits, and 'u+x' specifies adding execute permission for the user category. This is the standard way to make a script executable for its owner.

Exam trap

The trap here is confusing commands that modify ownership (chown, chgrp) with those that modify permissions (chmod); candidates may pick 'chown u+x' thinking it grants execute permission.

How to eliminate wrong answers

Option A is wrong because 'chown' changes file ownership, not permissions. Option B is wrong because 'chgrp' changes group ownership, not permissions. Option D is wrong because 'chperm' is not a valid Linux command; permissions are managed with 'chmod'.

33
MCQmedium

You need to append the output of a command to an existing file without overwriting it. Which operator should you use?

A.|
B.>
C.&
D.>>
AnswerD

The >> operator opens the target file in append mode, writing command output to the end without truncating existing content. A single > would overwrite the file, so >> satisfies the requirement to preserve prior data while adding new output.

Why this answer

The >> operator redirects standard output and appends it to the end of an existing file, preserving the file's current contents. This is the standard shell mechanism for adding output without truncating the file. Using >> is the correct way to log or accumulate command results over time.

Exam trap

The trap is the single vs. double angle bracket — candidates who don't read 'without overwriting' carefully pick > and silently destroy file contents, which is exactly the mistake the question is testing.

How to eliminate wrong answers

Option A is wrong because the pipe (|) sends the output of one command as input to another command, not to a file. Option B is wrong because the single > operator redirects output but truncates (overwrites) the target file, destroying existing content. Option C is wrong because & is used to run a command in the background (or as part of && for conditional execution), not for output redirection.

34
MCQhard

An operator is at a prompt and types cd - after having earlier changed from /etc/nginx to /var/www/html. What is the effect of that command?

A.It changes to the root directory because a lone dash is interpreted as the filesystem root.
B.It fails with an error because cd requires a valid directory path and a dash is not a path.
C.It moves up one level to the parent of the current directory, /var/www.
D.It returns the shell to /etc/nginx, the previous working directory, and prints that path.
AnswerD

The dash is a special operand that the cd builtin maps to the OLDPWD variable, which the shell updates on each successful directory change. Since the operator moved from /etc/nginx to /var/www/html, OLDPWD holds /etc/nginx, so the command switches back there and echoes the new directory.

Why this answer

The shell maintains the OLDPWD variable and updates it after every successful directory change. The cd builtin treats a bare dash as a request to switch to that stored path and then prints it, giving a quick toggle between two working directories without retyping long paths.

Exam trap

The trap here is confusing the dash with the two-dot parent reference or with the root slash, when the dash actually means the previous directory.

35
MCQhard

You want to create a symbolic link named 'link_to_file' that points to 'original_file'. Which command is correct?

A.link original_file link_to_file
B.ln -h original_file link_to_file
C.ln original_file link_to_file
D.ln -s original_file link_to_file
AnswerD

The -s flag instructs ln to create a symbolic link rather than a hard link, and the syntax places the existing target first, followed by the new link name. This produces 'link_to_file' pointing to 'original_file' as required.

Why this answer

The `ln -s` command creates a symbolic link, which is a special file that points to another file by name. The syntax is `ln -s <target> <link_name>`, so `ln -s original_file link_to_file` correctly creates a symlink named `link_to_file` that references `original_file`. Without `-s`, `ln` creates a hard link, which is a different mechanism entirely.

Exam trap

The trap here is confusing hard links with symbolic links: candidates may think `ln` alone creates a symbolic link, but it actually creates a hard link; the `-s` flag is mandatory for symbolic links.

How to eliminate wrong answers

Option A is wrong because `link` is a low-level utility that creates hard links only and does not support symbolic links; it also takes arguments in the order `link <target> <link_name>`, but even with correct order it cannot create a symlink. Option B is wrong because `ln -h` is not a valid option for creating symbolic links; `-h` is sometimes used with other commands to affect how symlinks are followed, but for `ln` it is not the flag for symlink creation. Option C is wrong because `ln original_file link_to_file` creates a hard link, not a symbolic link; hard links share the same inode and cannot cross filesystems or link to directories.

36
MCQmedium

What is the purpose of the '..' notation in a file path?

A.Parent directory
B.Current directory
C.Root directory
D.Home directory
AnswerA

The '..' entry is a hard link present in every directory, pointing to its parent. It lets paths traverse upward, so /home/user/.. resolves to /home. This is distinct from '.' which refers to the current directory itself.

Why this answer

In filesystem path notation, a single dot (.) refers to the current directory, while two dots (..) refer to the parent directory — the directory one level above the current working directory. This is a POSIX convention used across Linux, macOS, and other Unix-like systems.

Exam trap

The trap here is confusing the single dot (current directory) with the double dot (parent directory), or assuming .. always means root — candidates who mix up these symbols pick the wrong option.

How to eliminate wrong answers

Option B is wrong because the current directory is represented by a single dot (.), not two dots. Option C is wrong because the root directory is represented by a leading forward slash (/), not by .. — .. only reaches root if you traverse up enough levels. Option D is wrong because the home directory is referenced by the tilde (~) or the $HOME environment variable, not by ...

37
Multi-Selectmedium

A technician is examining files in /var/tmp and needs to identify which entries are directories rather than regular files. Which two commands can provide this information? (Choose two.)

Select 2 answers
A.wc -c /var/tmp
B.ls -l /var/tmp
C.cat /var/tmp/*
D.file /var/tmp/*
E.du -sh /var/tmp
AnswersB, D

The long listing format shows a file type character as the first column of each entry; a leading d indicates a directory, while a leading hyphen indicates a regular file. Running ls -l /var/tmp therefore lets the technician distinguish directories from regular files at a glance, along with permissions, owner, size, and timestamp.

Why this answer

Both ls -l and file reveal the nature of each entry: the long listing encodes the type in its first character, and the file utility prints a descriptive type for every argument. The remaining commands either print raw contents, summarize total disk usage, or count bytes, none of which separates directories from regular files in /var/tmp.

Exam trap

The trap here is assuming that any command which accepts a path can classify it, when cat, du, and wc only measure or dump data rather than report file type.

38
MCQmedium

What is the purpose of the 'tee' command?

A.To join files
B.To split output to file and screen
C.To format output
D.To filter output
AnswerB

The tee command reads standard input and writes it simultaneously to standard output and to one or more named files, so a pipeline's data appears on screen while also being saved. This satisfies the stem's requirement of splitting output between file and screen.

Why this answer

The 'tee' command reads from standard input and writes to both standard output (the screen) and one or more files simultaneously. It is named after a T-splitter in plumbing, reflecting how it splits the data stream. This is useful for capturing output while still viewing it in real time, such as logging a command's output without losing visibility.

Exam trap

The trap here is confusing 'tee' with commands that combine or filter data, such as 'cat' or 'grep', because all involve input/output manipulation. Candidates might overlook that 'tee' specifically duplicates rather than transforms.

How to eliminate wrong answers

Option A is wrong because joining files is typically done with 'cat' or 'paste', not 'tee'. Option C is wrong because formatting output is handled by tools like 'printf', 'awk', or 'sed', not 'tee'. Option D is wrong because filtering output is the purpose of commands like 'grep', 'sed', or 'awk', whereas 'tee' does not filter; it duplicates.

39
MCQhard

A user runs `pwd` and sees `/home/alex/projects`. They then run `cd ../reports` and `pwd` again. What is the second `pwd` output?

A./home/alex/projects/../reports
B./home/reports
C./home/alex/projects/reports
D./home/alex/reports
AnswerD

Starting from `/home/alex/projects`, the `..` component resolves to `/home/alex`. The subsequent `reports` component then descends into the reports directory located there. The final working directory is therefore `/home/alex/reports`. This is a standard relative navigation pattern that combines a parent traversal with a descent into a sibling directory.

Why this answer

The relative path `../reports` first ascends one level from `/home/alex/projects` to `/home/alex`, then descends into the `reports` child there. Since each component is resolved in sequence against the evolving location, the final directory is `/home/alex/reports`, which is what the second `pwd` reports.

Exam trap

The trap here is forgetting that `..` is processed before the following component, so the descent happens in the parent rather than the original directory.

40
MCQeasy

Which command provides a brief summary of what a specific command does without opening the entire man page?

A.info
B.whatis
C.man -d
D.apropos
AnswerB

The whatis command queries the manual page database and returns the one-line description stored for a command, satisfying the requirement for a brief summary without opening the full man page. Unlike man, it does not page through the complete documentation.

Why this answer

The whatis command displays the one-line description from the man page database for a given command, providing a brief summary without opening the full manual. It reads from the whatis database created by mandb, making it fast and concise. This is exactly the 'brief summary' behavior the question asks for.

Exam trap

The trap here is confusing whatis (brief summary of one command) with apropos (keyword search across many commands) or info (full GNU documentation); candidates often pick apropos because it also 'describes' commands.

How to eliminate wrong answers

Option A is wrong because info opens the GNU Info documentation system, which is a full hypertext manual, not a brief summary. Option C is wrong because man -d is not a standard option for a summary; man -d is sometimes used for debugging output, and man -k is the actual keyword search. Option D is wrong because apropos searches man page descriptions by keyword and returns multiple matches, rather than summarizing one specific command.

41
MCQmedium

A technician needs to locate every file under '/usr/share' whose name ends with '.conf'. Which command produces this list by searching the directory tree?

A.which '*.conf' /usr/share
B.find /usr/share -name '*.conf'
C.locate '/usr/share/*.conf'
D.grep -r '/usr/share' '*.conf'
AnswerB

find /usr/share starts at the given directory and recursively descends the tree. The -name test matches the final path component against the shell-style pattern '*.conf', returning every matching file. Quoting prevents the shell from expanding the pattern prematurely. This is the canonical, reliable method for locating files by name pattern within a directory hierarchy.

Why this answer

Searching a directory tree for files by name pattern is the purpose of find with the -name test. The which command only checks PATH executables, locate relies on a possibly stale database and does not handle anchored globs the same way, and grep examines file contents rather than names. Quoting the pattern ensures the shell passes it literally to find.

Exam trap

The trap here is confusing tools that search file contents, like grep, or databases, like locate, with tools that walk the filesystem tree by name.

42
MCQmedium

While exploring a system, an administrator runs `ls -a` inside a directory and sees entries named `.` and `..` in addition to regular files. What do these two entries represent?

A.Symbolic links pointing to the filesystem root
B.Hidden configuration files created by the user
C.Temporary files scheduled for deletion by the system
D.The current directory and its parent directory
AnswerD

In every directory, `.` is a hard link to the directory itself, and `..` is a hard link to its parent. They appear only when hidden entries are listed, which is why `ls -a` reveals them. These entries make relative navigation possible, so a command like `cd ..` works without knowing the parent's name. The root directory's `..` points back to root itself.

Why this answer

The single dot is a reference to the directory containing it, and the double dot references that directory's parent. Both are ordinary directory entries maintained by the filesystem, hidden from default listings because their names begin with a dot. They underpin relative path resolution, allowing commands to address the current or parent directory without spelling out full absolute paths.

Exam trap

The trap here is treating `.` and `..` as hidden user files rather than as built-in directory references that govern relative navigation.

43
MCQhard

A technician needs to locate all files under /var that are larger than 100 MB and were modified more than 30 days ago. Which command will produce this list?

A.ls -lS /var | grep +100M
B.locate -size +100M -mtime +30 /var
C.find /var -size 100M -mtime 30
D.find /var -size +100M -mtime +30
AnswerD

The find command with -size +100M matches files larger than 100 megabytes, and -mtime +30 matches files whose data was last modified more than 30 days ago. Together they filter exactly the requested files under /var. This is the standard and correct syntax for combining size and modification time criteria in a single find invocation.

Why this answer

The find command is designed for filesystem searches based on metadata such as size and modification time. Using -size +100M and -mtime +30 correctly selects files larger than 100 MB and older than 30 days. Other tools like locate lack metadata filters, ls does not recurse or filter, and omitting the plus signs changes the meaning to exact matches, which would not return the intended set of files.

Exam trap

The trap here is forgetting that find treats numeric arguments without a leading plus as exact matches, so -mtime 30 means exactly 30 days, not more than 30 days.

44
MCQmedium

You are using the 'less' command to view a large log file. Which key do you press to search forward for a specific string?

A.?
B./
C.q
D.n
AnswerB

Within the pager, pressing / opens a forward search prompt, letting you type a string and jump to its next occurrence in the log. This satisfies the requirement to search forward through the file's contents without leaving less.

Why this answer

In the 'less' pager, pressing '/' initiates a forward search for a specified string. After typing the pattern and pressing Enter, 'less' highlights all matches and jumps to the first occurrence after the current position. This is consistent with the vi/vim editor's search behavior, which 'less' mimics for user familiarity.

Exam trap

The trap here is confusing the forward search key '/' with the backward search key '?', as both are used for searching but in opposite directions; candidates often mix them up under pressure.

How to eliminate wrong answers

Option A is wrong because '?' is used for backward search in 'less', not forward search. Option C is wrong because 'q' quits the 'less' program entirely, returning to the shell. Option D is wrong because 'n' repeats the previous search in the same direction, but it does not initiate a new search.

45
Multi-Selecthard

Which TWO of the following are valid ways to create a directory?

Select 2 answers
A.touch
B.install -d
C.mkdir
D.ln
E.cp -d
AnswersB, C

The install command's -d flag creates each named directory plus any missing parent directories, mirroring mkdir -p behaviour. This satisfies the stem's requirement for a valid directory-creation method, since install -d is a documented GNU coreutils option that builds the full path in one invocation.

Why this answer

Option C, mkdir, is correct because mkdir is the standard Linux command whose sole purpose is to create directories (e.g., mkdir /path/to/dir), and it can create intermediate directories with the -p flag. Option B, install -d, is correct because install with the -d (directory) option creates each specified directory along with any missing parent directories, commonly used in scripts and Makefiles to create destination directories with controlled permissions. The unmarked options do not belong: touch creates or updates empty files (not directories), ln creates hard or symbolic links, and cp -d preserves symbolic links during a copy rather than creating a directory.

Exam trap

The trap is that `install` sounds like it only installs software, so candidates dismiss `install -d` — but on Linux it is a coreutils command that creates directories with explicit attributes.

46
MCQeasy

A user has a file named notes.txt in /home/alex and wants to create a copy named notes_backup.txt in the same directory without altering the original. Which command accomplishes this?

A.ln notes.txt notes_backup.txt
B.cp notes.txt notes_backup.txt
C.cat notes.txt > notes_backup.txt
D.mv notes.txt notes_backup.txt
AnswerB

The cp command copies the contents of the source file to a new destination file, leaving the original notes.txt untouched. This directly satisfies the requirement of creating notes_backup.txt in the same directory while preserving the original file for continued use.

Why this answer

Copying a file while keeping the original is exactly what cp does. The syntax cp source destination creates a new file with the same content and leaves the source in place. Renaming with mv, linking with ln, or redirecting with cat either removes the original name, shares the same inode, or lacks the robustness of a dedicated copy utility.

Exam trap

The trap here is confusing moving with copying, since mv also takes two filenames and appears to produce a new file, but it removes the original name.

47
MCQeasy

A junior administrator is at a shell prompt in /home/alex and wants to see a compact, one-line-per-entry listing that includes hidden files along with their permissions and sizes. Which command accomplishes this?

A.ls -i
B.ls -R
C.ls -d
D.ls -la
AnswerD

The -l flag produces a long listing showing permissions, ownership, size, and modification time, while -a includes entries beginning with a dot such as .bashrc. Running this from /home/alex gives exactly the compact one-line-per-entry view the administrator requested, including hidden files.

Why this answer

A long listing is produced with -l, and hidden entries are included with -a. Combining the two flags gives permissions, ownership, size, timestamps, and dotfiles in a single-column format, which matches the administrator's goal of inspecting everything in the current directory without recursion or extra inode data.

Exam trap

The trap here is assuming that a plain ls already shows hidden dotfiles, when only the -a flag adds them.

48
MCQmedium

When using 'man', what does the section number '5' refer to?

A.User commands
B.File formats
C.System calls
D.Kernel routines
AnswerB

Section 5 of the manual documents file formats and conventions, such as /etc/passwd or proc file layouts, rather than commands or system calls. It is the section consulted when you need the structure of a configuration or data file.

Why this answer

In the Linux man page section scheme, section 5 is reserved for file formats and conventions (e.g., /etc/passwd, /etc/fstab). Section 1 is user commands, section 2 is system calls, and section 3 is library functions. Knowing the section numbers lets you disambiguate pages like 'passwd' (1 vs 5).

Exam trap

The trap is confusing section 5 (file formats) with section 2 (system calls) or section 3 (library functions) — candidates often assume '5' refers to something more technical like kernel routines.

How to eliminate wrong answers

Option A is wrong because user commands are section 1 (e.g., man 1 ls). Option C is wrong because system calls are section 2 (e.g., man 2 open). Option D is wrong because kernel routines are also covered under section 2 (system calls) or section 9 on some systems (kernel developer docs), not section 5.

49
MCQeasy

A junior administrator is logged into a Linux server and needs to view the contents of the file '/etc/hosts' without opening an editor. Which command should they run?

A.mkdir /etc/hosts
B.cat /etc/hosts
C.nano /etc/hosts
D.chmod /etc/hosts
AnswerB

The cat command concatenates and prints file contents to standard output, so running cat /etc/hosts displays the file directly in the terminal. It is the simplest way to view a short file without launching an editor. Since /etc/hosts is typically small, cat is appropriate and does not paginate or modify the file.

Why this answer

Viewing a file without editing it requires a reader such as cat, which streams the file to standard output. Editors like nano, permission tools like chmod, and directory creators like mkdir all serve different purposes and would either modify state or fail outright. For a short configuration file, cat is the direct and correct choice.

Exam trap

The trap here is assuming any command that accepts a filename as an argument will display that file's contents.

50
Multi-Selecthard

An administrator is reviewing how pathnames are resolved on a Linux system and wants to identify statements that correctly describe absolute and relative paths. (Choose two.)

Select 2 answers
A.Any path containing a dot component is treated as an absolute path by the shell.
B.The path `../docs/report.txt` is relative and refers to a file in a sibling directory of the current one.
C.A relative path is resolved against the root directory when the shell's current directory is unset.
D.An absolute path always begins with a forward slash and is interpreted from the root directory.
E.Two different relative paths can never resolve to the same file.
AnswersB, D

Because the path does not start with a slash, it is relative to the current working directory. The leading `..` moves up to the parent, and `docs` then descends into a sibling of the current directory, locating `report.txt` there. This is a common idiom for referencing nearby directories without spelling out a full absolute path, and the description is accurate.

Why this answer

Absolute paths anchor at the root because of the leading slash, while relative paths are interpreted against the process working directory. The `..` component lets a relative path climb to a parent and then descend elsewhere, which is how a sibling directory can be addressed without a full path. Two statements correctly describe these behaviors, and the remaining ones misstate resolution rules.

Exam trap

The trap here is assuming dots or textual form determine whether a path is absolute, when only the leading slash does.

51
MCQhard

An administrator wants to create a hard link named 'report_link' to an existing file '/data/report.txt' on the same filesystem. Which command creates this hard link?

A.cp -l /data/report.txt report_link
B.link -s /data/report.txt report_link
C.ln /data/report.txt report_link
D.ln -s /data/report.txt report_link
AnswerC

The ln command without options creates a hard link. Both /data/report.txt and report_link then reference the same inode, so they are indistinguishable entries for the same data. The link count of the inode increases by one. This is the correct syntax and produces a true hard link as requested.

Why this answer

A hard link is created with ln followed by the existing file and the new link name, producing two directory entries that share one inode. The -s flag would create a symbolic link instead, and the link utility lacks that flag. While cp -l can also hard-link, ln is the direct, standard command for this operation.

Exam trap

The trap here is mixing up the -s flag, which switches to symbolic links, with the default behavior of creating hard links.

52
MCQmedium

You need to search for a specific command description within the manual pages using a keyword. Which command should you use?

A.man -s
B.man -f
C.man -k
D.help
AnswerC

`man -k` searches the manual page's short descriptions (the whatis database) for a keyword, returning every matching entry. This directly satisfies the stem's requirement to locate a command by keyword rather than browsing a single page, which plain `man` cannot do.

Why this answer

The 'man -k' option (equivalent to 'apropos') searches the manual page short descriptions for a keyword and returns all matching entries, which is exactly what you need when you know a concept but not the command name. It queries the whatis database built by mandb/makewhatis. This is the standard way to locate commands by keyword rather than by exact name.

Exam trap

The trap here is confusing 'man -k' (keyword search across descriptions, like apropos) with 'man -f' (exact-name lookup, like whatis) — candidates often pick -f thinking it means 'find'.

How to eliminate wrong answers

Option A is wrong because 'man -s' selects a specific manual section (e.g., 'man -s 1 ls' for section 1), not a keyword search. Option B is wrong because 'man -f' (equivalent to 'whatis') returns a one-line description for an exact command name, not a keyword-based search across descriptions. Option D is wrong because 'help' is a shell builtin that displays information about shell builtins, not a tool for searching manual page descriptions.

53
MCQeasy

Which of the following commands is used to create an empty file or update the timestamp of an existing file?

A.cp
B.touch
C.mkdir
D.mv
AnswerB

The `touch` command creates a zero-byte file when the target does not exist, and updates the access and modification timestamps to the current time when it does. This dual behaviour directly satisfies the stem's requirement to either create an empty file or refresh an existing file's timestamp.

Why this answer

The `touch` command is specifically designed to create an empty file if it does not exist, or update the access and modification timestamps of an existing file to the current time. It does this by making a `utime()` system call, which sets the file's timestamps without altering its content. This is the standard Linux/Unix utility for timestamp manipulation and empty file creation.

Exam trap

The trap here is confusing file creation with directory creation or file copying; candidates might think `cp` or `mkdir` can create empty files, but only `touch` is purpose-built for that and timestamp updates.

How to eliminate wrong answers

Option A is wrong because `cp` copies files or directories, and while it can create a new file as a copy, it does not create an empty file by default nor does it update timestamps of an existing file without copying content. Option C is wrong because `mkdir` creates directories, not files, and does not affect timestamps. Option D is wrong because `mv` moves or renames files, which changes the file's location or name but does not create an empty file or update timestamps in the sense described.

54
MCQeasy

A junior administrator opens a terminal in their home directory and runs the command `cd /var/log` followed by `cd ..`. Which directory are they now in?

A./var/log
B./home
C./var
D./
AnswerC

The `cd /var/log` command changes the shell's working directory to the log subdirectory, and `cd ..` refers to the parent of the current directory. Since the parent of `/var/log` is `/var`, the administrator ends up in `/var`. The `..` entry is a real directory link maintained by the filesystem in every directory, so the traversal is deterministic.

Why this answer

The shell tracks a current working directory, and `cd` modifies it. An absolute path such as `/var/log` jumps directly to that location regardless of where the user started, while the special entry `..` always denotes the parent of the current directory. Applying `..` once from `/var/log` therefore lands in `/var`, the immediate parent of the log directory.

Exam trap

The trap here is assuming `..` returns to the previous directory or the home directory, when it always means the parent of the current location.

55
MCQmedium

A technician needs to inspect a configuration file located at `/etc/example/app.conf` without changing the current working directory, and they want the shell prompt to keep showing their present location afterward. Which command accomplishes this?

A.cat /etc/example/app.conf
B.cd /etc/example && cat app.conf
C.less /etc/example/app.conf
D.cd /etc/example; cat app.conf; cd -
AnswerA

Passing the fully qualified path to `cat` opens and prints the file without invoking `cd`, so the shell's working directory and prompt remain exactly as they were. Absolute paths are resolved from the root of the filesystem, independent of where the user currently stands. This satisfies both the inspection goal and the requirement to leave the session location untouched.

Why this answer

Reading a file never requires the shell to relocate. Supplying the absolute path `/etc/example/app.conf` to `cat` lets the kernel resolve the file from the filesystem root while the process working directory stays unchanged. The prompt continues to report the original directory because no `cd` was executed, which is precisely the behavior the technician requested.

Exam trap

The trap here is believing a directory change is necessary before reading a file, when absolute paths let any file be accessed from anywhere.

56
MCQmedium

You are currently in '/home/user/docs' and need to move to '/etc'. Which command is correct?

A.cd ~/etc
B.cd ../../etc
C.cd /etc
D.cd etc
AnswerC

`cd /etc` uses an absolute path, so the shell resolves it from the filesystem root regardless of the current working directory. This satisfies the stem's constraint of moving from `/home/user/docs` to `/etc` in a single step, without relying on relative traversal such as `../../etc`.

Why this answer

`cd /etc` uses an absolute path (starting with /), which navigates directly to /etc regardless of the current working directory. Absolute paths are resolved from the filesystem root, so this works from anywhere. This is the correct and unambiguous way to move to /etc.

Exam trap

The trap is confusing relative and absolute paths — 010-160 tests whether you recognize that only a leading / guarantees navigation to the system root's /etc.

How to eliminate wrong answers

Option A is wrong because `cd ~/etc` expands to /home/user/etc (the etc directory inside the user's home), not the system /etc — the tilde expands to $HOME. Option B is wrong because `cd ../../etc` is a relative path that from /home/user/docs goes up two levels to /home, then into /home/etc, which does not exist. Option C is correct.

Option D is wrong because `cd etc` is a relative path looking for an 'etc' subdirectory inside the current directory (/home/user/docs/etc), which does not exist.

57
Multi-Selecthard

Which THREE of the following are types of manual page sections?

Select 3 answers
A.Network protocols (10)
B.User commands (1)
C.System calls (2)
D.File formats (5)
E.Kernel hardware (20)
AnswersB, C, D

User commands is a manual page section type, documenting commands a user can run. It sits alongside name, synopsis, description, options, files, see also and author sections, satisfying the question's request for a genuine manual page section category.

Why this answer

The Linux manual pages are organized into numbered sections, and the three options marked correct are genuine section types: B 'User commands (1)' is section 1, which documents executable programs and shell commands users can run; C 'System calls (2)' is section 2, which documents the kernel system-call interface used by programs such as open(2) and read(2); and D 'File formats (5)' is section 5, which documents file formats and conventions such as /etc/passwd(5) and proc(5). The unmarked options do not belong: A 'Network protocols (10)' is not a manual section (section 10 does not exist in the standard man-pages layout), and E 'Kernel hardware (20)' is not a manual section either (section 20 is not a standard section; hardware-related pages typically appear in section 4, 'Devices and special files').

Exam trap

The trap here is that candidates may assume any numbered category is a valid man section, but only sections 1-9 exist; options like '10' or '20' are fabricated to test whether you know the actual section numbering scheme.

58
MCQmedium

A junior administrator needs to display the full contents of /etc/hostname and also see line numbers next to each line. Which command accomplishes this?

A.wc -l /etc/hostname
B.cat -n /etc/hostname
C.less -N /etc/hostname
D.head -n /etc/hostname
AnswerB

The cat utility with the -n option numbers every output line, including blank ones, before printing the file. Running cat -n /etc/hostname therefore shows the full contents with a line number prefix, which is exactly what the administrator requested, and it works without invoking a pager or editor.

Why this answer

The cat command copies file contents to standard output, and its -n option prepends a line number to every line, including empty ones. That combination displays the entire file with numbering in a single non-interactive command. The alternatives either misuse an option, open an interactive pager, or merely count lines instead of showing the content.

Exam trap

The trap here is assuming that any command with an 'n' option produces line numbers, when in fact head and wc use that letter for a count or a line count respectively.

59
MCQmedium

You are copying a directory named 'source' to 'destination' and want to ensure all subdirectories and file attributes are preserved. Which flag is essential?

A.cp -a
B.cp -p
C.cp -v
D.cp -r
AnswerA

The `-a` flag combines `-R`, `-p` and `-d`, recursively copying while preserving permissions, ownership, timestamps and symbolic links. This directly satisfies the stem's requirement that all subdirectories and file attributes survive the copy, which a plain `cp -R` would not guarantee.

Why this answer

The `-a` (archive) flag is a combination of `-dR --preserve=all`, which recursively copies directories while preserving symbolic links, file permissions, ownership, timestamps, and extended attributes. This makes it the only option that ensures all subdirectories and file attributes are preserved in a single command. While `-p` preserves some attributes, it does not recurse into subdirectories, and `-r` recurses but does not preserve attributes.

Therefore, `cp -a` is essential for a complete archive copy.

Exam trap

The trap here is confusing `-p` with `-a`: candidates often think `-p` preserves all attributes, but it does not recurse, and `-r` alone does not preserve attributes, so only `-a` satisfies both requirements.

How to eliminate wrong answers

Option B is wrong because `cp -p` preserves mode, ownership, and timestamps but does not copy directories recursively, so subdirectories would be omitted. Option C is wrong because `cp -v` only enables verbose output, showing files as they are copied, but does not preserve attributes or ensure recursion. Option D is wrong because `cp -r` copies directories recursively but does not preserve file attributes such as permissions, ownership, or timestamps, making it insufficient for the requirement.

60
MCQeasy

You are logged into a terminal and want to identify your current working directory. Which command should you execute?

A.pwd
B.whoami
C.ls
D.cd
AnswerA

`pwd` prints the absolute path of the shell's current working directory, directly satisfying the stem's requirement to identify where you are in the filesystem. Unlike `ls`, which lists directory contents, or `cd`, which changes location, `pwd` reports the present directory without altering state.

Why this answer

The pwd (print working directory) command displays the absolute path of the current working directory. It is the standard Linux command for identifying where you are in the filesystem hierarchy.

Exam trap

The trap here is confusing basic navigation commands; candidates might select ls or cd because they are directory-related, but only pwd specifically prints the current working directory.

How to eliminate wrong answers

Option B is wrong because whoami displays the current username, not the directory. Option C is wrong because ls lists the contents of a directory, not the directory path itself. Option D is wrong because cd changes the working directory rather than displaying it.

61
MCQeasy

To see the contents of a directory, which command is standard?

A.ls
B.dir
C.list
D.cat
AnswerA

ls is the POSIX-standard utility for listing directory entries, printing filenames to standard output. It exists on every Linux and Unix system, making it the canonical command for viewing a directory's contents in the shell.

Why this answer

`ls` is the standard POSIX/Linux command for listing directory contents, and it is present on every Linux distribution as part of coreutils. It reads directory entries via the readdir() system call and prints them to stdout, with options like -l, -a, and -h for formatting. It is the canonical answer for 'list directory contents' on Linux.

Exam trap

The trap here is confusing DOS/Windows commands (`dir`) with Linux commands, or assuming `cat` can list directories — LFCS/010-160 frequently tests basic command recognition.

How to eliminate wrong answers

Option B is wrong because `dir` is a DOS/Windows command (also available as a GNU coreutils alias on some Linux systems, but not the standard Linux answer). Option C is wrong because `list` is not a Linux command at all — it does not exist in coreutils or any standard shell. Option D is wrong because `cat` concatenates and prints file contents; it does not list directory entries (running `cat` on a directory returns 'Is a directory').

62
MCQmedium

A developer working in /srv/project wants to create a symbolic link named latest that points to the file releases/v2.1/app.tar.gz, keeping the link inside /srv/project. Which command creates this link correctly?

A.cp -s releases/v2.1/app.tar.gz latest
B.ln -s latest releases/v2.1/app.tar.gz
C.ln -s releases/v2.1/app.tar.gz latest
D.ln releases/v2.1/app.tar.gz latest
AnswerC

The -s option tells ln to create a symbolic link whose contents store the path releases/v2.1/app.tar.gz, and the final argument latest is the new link name in the current directory. This matches the developer's request for a symlink inside /srv/project.

Why this answer

Symbolic links are created with ln -s, and the operand order is target first, link name second. Naming the relative path releases/v2.1/app.tar.gz as the target and latest as the new link places the symlink in the current directory and stores the relative path, which is what the developer intended.

Exam trap

The trap here is forgetting that ln without -s makes a hard link, which behaves very differently and cannot span filesystems or target directories.

63
Multi-Selectmedium

Which TWO of the following options can be used with 'rm' to ensure safe operation?

Select 2 answers
A.-I
B.-v
C.-r
D.-f
E.-i
AnswersA, E

The -I flag prompts once before removing more than three files or recursively deleting, offering a single confirmation rather than per-file prompts. This satisfies the stem's safety requirement by catching broad or recursive deletions before any file is unlinked.

Why this answer

Option A (-I) is correct because it makes rm prompt once before removing more than three files (or recursively), providing a safety net against accidental mass deletion while avoiding the constant prompting of -i. Option E (-i) is correct because it forces rm to prompt for confirmation before every single removal, which is the classic way to ensure safe, deliberate operation. The unmarked options do not belong: -v only prints what is being removed without any confirmation, -r enables recursive deletion of directories (increasing risk rather than safety), and -f forces removal without prompting and ignores nonexistent files, directly defeating safe operation.

Exam trap

The trap is confusing '-i' and '-I' with '-f' and '-r' — candidates often think '-f' is safe because it 'forces' something, but it actually disables prompts, making it dangerous.

64
MCQeasy

What is the primary difference between 'man' pages and 'info' pages?

A.man is graphical, info is text-based
B.man pages are obsolete
C.man is for system files, info is for users
D.info contains more detailed, hyperlinked documentation
AnswerD

info pages are rendered by the GNU Texinfo system, producing structured documents with hyperlinks, menus and cross-references between nodes. man pages are single flat troff documents without navigable links, so info offers richer, interconnected browsing of detailed GNU documentation.

Why this answer

Info pages are GNU's hypertext documentation system, providing more detailed, structured, and hyperlinked content than traditional man pages. They are navigated with the 'info' command using nodes, menus, and cross-references, making them better suited for complex GNU tools like coreutils and bash. Man pages, by contrast, are single-page, linear reference documents.

Exam trap

The trap is confusing the delivery format (text vs graphical) or audience (system vs user) with the actual distinction, which is the hyperlinked, node-based structure and greater depth of info pages.

How to eliminate wrong answers

Option A is wrong because both man and info are text-based terminal tools — neither is graphical (though both can be viewed in graphical front-ends like yelp or konqueror). Option B is wrong because man pages are not obsolete; they remain the primary reference format on virtually all Unix-like systems and are actively maintained. Option C is wrong because man pages cover both system files (section 5) and user commands (section 1), and info pages likewise cover both user and system topics — the distinction is not about audience.

65
Multi-Selectmedium

Which THREE of the following are valid directory navigation commands?

Select 3 answers
A.ls
B.mkdir
C.pushd
D.pwd
E.cd
AnswersC, D, E

`pushd` saves the current directory onto a stack before changing to the specified path, letting you return later with `popd`. This stack-based directory switching satisfies the stem's requirement for a valid navigation command, unlike commands that merely list or manipulate files without altering the working directory.

Why this answer

The three valid directory navigation commands are pushd (C), pwd (D), and cd (E). cd (E) changes the current working directory, which is the core navigation command in Linux/Unix shells. pwd (D) prints the absolute pathname of the current working directory, confirming where you are in the directory tree. pushd (C) pushes the current directory onto the directory stack and changes to a new directory, enabling stack-based navigation (paired with popd). The unmarked options do not belong: ls (A) lists directory contents rather than navigating, and mkdir (B) creates a new directory rather than changing location.

Exam trap

The trap is that ls and mkdir are directory-related commands, so candidates lump them in with navigation — the exam expects you to distinguish commands that change your location from those that list or create directories.

Ready to test yourself?

Try a timed practice session using only Finding Your Way On A Linux System questions.