CCNA Lxp System Management Questions

75 of 153 questions · Page 2/3 · Lxp System Management topic · Answers revealed

76
MCQmedium

An administrator wants to start a long-running script in the background so that it continues running even after logging out. Which command should be used?

A.script.sh &
B.nohup script.sh &
C.nohup script.sh
D.bg script.sh
AnswerB

Correct: nohup allows process to survive logout; & runs in background.

Why this answer

nohup prevents the process from receiving SIGHUP when the terminal closes. & runs it in background.

77
MCQmedium

An administrator wants to change the priority of a running process with PID 1234 to a lower priority (nicer). The current nice value is 0. Which command will set the nice value to 10?

A.renice 10 -p 1234
B.nice -n 10 kill 1234
C.chrt -p 10 1234
D.kill -10 1234
AnswerA

Correct: renice sets the nice value for the process.

Why this answer

The `renice` command is used to alter the scheduling priority of an already running process. By default, a process starts with a nice value of 0. Running `renice 10 -p 1234` sets the nice value to 10, which is a lower priority (more 'nice') because the kernel adds this value to the dynamic priority calculation, giving the process less CPU time.

Exam trap

Cisco often tests the distinction between `renice` (for running processes) and `nice` (for launching a new process with a modified priority), and candidates may confuse `renice` with `nice` or think `kill` can change priority via signal numbers.

How to eliminate wrong answers

Option B is wrong because `nice -n 10 kill 1234` attempts to run the `kill` command with a nice value of 10, but `kill` does not change the priority of an existing process; it sends signals. Option C is wrong because `chrt -p 10 1234` sets the real-time scheduling policy and priority (via the `-p` flag with a priority value), not the nice value; `chrt` manipulates the SCHED_FIFO or SCHED_RR policy, not the conventional nice/renice mechanism. Option D is wrong because `kill -10 1234` sends signal 10 (SIGUSR1 by default on Linux) to the process, which has no effect on its nice value or scheduling priority.

78
Multi-Selecthard

A technician is troubleshooting a service that fails to start. The service file is located in /usr/lib/systemd/system. Which THREE commands can be used to investigate the service's status and logs? (Choose three.)

Select 3 answers
A.systemctl enable servicename
B.journalctl -u servicename
C.systemctl status servicename
D.systemctl start servicename
E.journalctl -f
AnswersB, C, E

Shows logs for the service.

Why this answer

systemctl status shows service status; journalctl -u shows logs for the unit; journalctl -f follows new log entries. systemctl start attempts to start but not investigate; systemctl enable enables at boot.

79
MCQmedium

A Linux administrator needs to locate all files in the /var directory that have been modified within the last 30 minutes and are larger than 10MB. Which command accomplishes this task?

A.find /var -mmin 30 -size +10M
B.find /var -mmin -30 -size +10M
C.locate /var -mmin -30 -size +10M
D.find /var -mtime -30 -size +10M
AnswerB

Correct: -mmin -30 matches files modified less than 30 minutes ago, and -size +10M matches files larger than 10MB.

Why this answer

The find command with -mmin and -size options can locate files based on modification time and size. -mmin -30 finds files modified less than 30 minutes ago, and -size +10M finds files larger than 10MB.

80
Multi-Selecteasy

Which three directories are required by the FHS to be present on a Linux system? (Select THREE.)

Select 3 answers
A./bin
B./proc
C./dev
D./etc
E./opt
AnswersA, C, D

Essential user binaries.

Why this answer

/bin, /etc, and /dev are essential FHS directories. /opt is optional, /proc is a virtual filesystem, /mnt is for temporary mounts but not always present.

81
Multi-Selectmedium

A Linux administrator needs to locate all files in the /etc directory that have been modified in the last 24 hours and are not owned by root. Which two commands can be combined to achieve this? (Select TWO.)

Select 2 answers
A.find /etc -mtime 0 -not -user root
B.find /etc -ctime 0 -not -group root
C.find /etc -mmin -1440 -not -user root
D.find /etc -mtime 0 -uid 0
E.find /etc -atime 0 -not -user root
AnswersA, C

Correct: finds files modified in last 24 hours not owned by root.

Why this answer

find with -mtime 0 finds files modified in the last 24 hours; -not -user root excludes root-owned files. The -exec option executes ls -l to list details.

82
MCQeasy

Which command displays real-time information about running processes, including CPU and memory usage, and updates the display dynamically?

A.htop
B.ps aux
C.jobs
D.top
AnswerD

top provides real-time dynamic process information.

Why this answer

top displays a dynamic real-time view of running processes and system resource usage.

83
Multi-Selectmedium

A user wants to create a hard link to a file. Which three conditions must be true for a hard link to be created successfully? (Choose three.)

Select 3 answers
A.The source file must have the SUID bit set.
B.The link must have the same name as the source.
C.The source and link must be on the same filesystem.
D.The source file must be a regular file, not a directory.
E.The source file must exist.
AnswersC, D, E

Correct: hard links cannot cross filesystem boundaries.

Why this answer

Hard links cannot span filesystems, cannot link to directories (except by root with special options), and the target must exist. They share the same inode.

84
Multi-Selectmedium

A technician needs to apply an access control list (ACL) to a file to grant read and write permissions to a specific user. Which two commands are used to manage ACLs? (Choose two.)

Select 2 answers
A.chmod
B.chown
C.umask
D.setfacl
E.getfacl
AnswersD, E

Sets ACL entries.

Why this answer

setfacl sets ACLs, getfacl retrieves them.

85
MCQhard

An administrator needs to find all files in /etc that have the SUID bit set. Which find command is correct?

A.find /etc -perm /4000
B.find /etc -exec ls -l {} \; | grep '^...s'
C.find /etc -perm -4000
D.find /etc -type f -perm 4000
AnswerA

Correct: /4000 matches files with SUID set.

Why this answer

The SUID bit is represented by the permission 4000. -perm /4000 checks if any of the bits in 4000 are set (SUID).

86
MCQmedium

A user reports that a specific process is consuming too much CPU. The administrator needs to change the priority of the process to a lower value (nicer). Which command sequence is appropriate?

A.nice -n -10 <PID>
B.kill -15 <PID>
C.chrt --idle <PID>
D.renice +10 -p <PID>
AnswerD

Correct: renice +10 increases niceness (lower priority).

Why this answer

renice changes the priority of an already running process by PID.

87
MCQeasy

A Linux administrator needs to view the last 10 lines of a log file named 'syslog'. Which command should be used?

A.cat syslog
B.head -10 syslog
C.less syslog
D.tail -10 syslog
AnswerD

Tail -10 shows the last 10 lines of the file.

Why this answer

The 'tail' command outputs the last lines of a file; by default it shows 10 lines.

88
MCQhard

A Linux engineer is troubleshooting a boot issue. The system boots to a command-line interface but does not start the graphical interface. Which systemd target should be set as default to boot into a graphical environment?

A.emergency.target
B.rescue.target
C.graphical.target
D.multi-user.target
AnswerC

This target boots into a graphical environment.

Why this answer

graphical.target is the systemd target for a graphical user interface.

89
MCQmedium

A Linux administrator wants to search for all occurrences of the word 'ERROR' in log files under /var/log, ignoring case, and also print the line numbers. Which command should be used?

A.grep -vi 'ERROR' /var/log
B.grep -rin 'ERROR' /var/log
C.grep -rn 'ERROR' /var/log
D.find /var/log -name '*ERROR*'
AnswerB

Correct: -r recursive, -i ignore case, -n line numbers.

Why this answer

grep -rin 'ERROR' /var/log searches recursively, ignores case, and prints line numbers. -i for case-insensitive, -n for line numbers, -r for recursive.

90
MCQmedium

A Linux administrator needs to remove a package installed via RPM and all its configuration files. Which command should the administrator use?

A.rpm -e package
B.rpm -V package
C.rpm -e --allmatches package
D.rpm -e --nodeps package
AnswerA

Correct: rpm -e removes the package and its configuration files.

Why this answer

rpm -e --nodeps removes the package but ignores dependencies; rpm -e --allmatches removes all versions; rpm -e package removes the package but leaves config files; rpm -V verifies package. To remove config files, use -e with --nodeps may still leave config. Actually, rpm -e removes the package and config files by default.

But among options, only rpm -e package is the correct removal; the other options are either verification or incorrect. However, the question asks to remove and all config files. rpm -e does that. Option A is rpm -V (verify).

Option B is rpm -e --nodeps (ignores dependencies, still removes config). Option C is rpm -e --allmatches (removes all versions). Option D is rpm -e package (standard removal).

All three removal options remove config? Actually rpm -e removes config files. So the best answer: rpm -e package. But note: --nodeps might be used if dependencies are a problem, but the question doesn't mention dependencies.

So the most straightforward is rpm -e package.

91
Multi-Selectmedium

An administrator needs to permanently disable a systemd service from starting at boot. Which two commands can achieve this? (Choose two.)

Select 2 answers
A.systemctl stop servicename
B.systemctl kill servicename
C.systemctl disable servicename
D.systemctl unmask servicename
E.systemctl mask servicename
AnswersC, E

Removes symlinks to prevent startup at boot.

Why this answer

systemctl disable and systemctl mask both prevent a service from starting at boot, but mask also prevents manual start.

92
Multi-Selectmedium

A Linux administrator wants to search for the pattern 'ERROR' in all files under /var/log, ignoring case, and display line numbers. Which THREE options should be used with the grep command? (Select THREE).

Select 3 answers
A.-c
B.-i
C.-v
D.-n
E.-r
AnswersB, D, E

Ignores case distinctions.

Why this answer

grep -r for recursive, -i for case-insensitive, -n for line numbers.

93
MCQhard

A process is running with a nice value of 5. The system administrator wants to increase its priority (lower the nice value) to -5 but is not the owner of the process. What must the administrator do first to achieve this?

A.Use renice -n +10
B.Use the nice command with -n -5
C.Use renice with root privileges via sudo
D.Use kill -SIGSTOP to stop the process then restart
AnswerC

Correct: renice requires root to change priority of another user's process.

Why this answer

Only root can increase priority (lower nice value) of another user's process. The administrator must use sudo or become root to run renice. Option A is incorrect because nice command starts a new process.

Option C is correct: run renice with sudo. Option D is incorrect because renice -n +10 would lower priority (increase nice).

94
MCQmedium

A technician needs to replace the string 'oldhost' with 'newhost' in the file /etc/hostname. Which sed command will perform this change in-place?

A.sed -i '/oldhost/d' /etc/hostname
B.sed 'y/oldhost/newhost/' /etc/hostname
C.sed -i 's/oldhost/newhost/g' /etc/hostname
D.sed 's/oldhost/newhost/g' /etc/hostname
AnswerC

Correct: -i for in-place, s/oldhost/newhost/g for substitution.

Why this answer

sed -i with s/pattern/replacement/ does an in-place substitution.

95
Multi-Selecthard

An administrator suspects that a malicious process is running and wants to list all processes, including those without a controlling terminal, and see their full command line. Which two commands can provide this information? (Select TWO.)

Select 2 answers
A.lsof
B.ps -eo pid,cmd
C.ps aux
D.ps -ef
E.top -b -n 1
AnswersC, D

Shows all processes with full command line.

Why this answer

ps aux shows all users, all processes, including those without tty, and includes the full command line. ps -ef also shows full listing with command line.

96
MCQeasy

A user reports that a script in /home/user/script.sh fails to execute. The output of 'ls -l script.sh' is '-rw-r--r-- 1 user user 1024 Apr 1 10:00 script.sh'. Which command should be used to make the script executable for all users?

A.chmod 644 script.sh
B.chmod a+x script.sh
C.chmod u+x script.sh
D.chmod 755 script.sh
AnswerB

Correct: a+x adds execute permission for all users (owner, group, others).

Why this answer

The file is currently not executable (rw-r--r--). To add execute permission for all users, use chmod a+x or chmod +x.

97
MCQmedium

An administrator runs the command `ls -l file.txt` and sees the permissions `-rwsr-xr-x`. What special permission is set on this file?

A.SGID
B.Sticky bit
C.No special permission
D.SUID
AnswerD

The 's' in owner execute indicates SUID.

Why this answer

The 's' in the owner execute position indicates the SUID (Set User ID) permission is set.

98
Multi-Selecthard

An administrator wants to view the contents of a compressed log file /var/log/syslog.2.gz without decompressing it to disk. Which two commands can be used to display the file contents? (Select TWO).

Select 2 answers
A.gzcat /var/log/syslog.2.gz
B.zcat /var/log/syslog.2.gz
C.less /var/log/syslog.2.gz
D.gunzip -c /var/log/syslog.2.gz
E.cat /var/log/syslog.2.gz
AnswersB, D

Correct: zcat decompresses and outputs to stdout.

Why this answer

zcat and gzcat (if available) decompress to stdout; some systems use zcat or gzip -dc.

99
MCQeasy

Which command creates a symbolic link named 'link.txt' that points to 'original.txt'?

A.symlink original.txt link.txt
B.ln -s original.txt link.txt
C.ln original.txt link.txt
D.ln -s link.txt original.txt
AnswerB

Correct syntax for symbolic link.

Why this answer

ln -s target link_name creates a symbolic link.

100
MCQeasy

A user needs to view the first 15 lines of a large log file. Which command is most appropriate?

A.head -n 15 filename
B.cat filename | head -n 15
C.less -N 15 filename
D.tail -n 15 filename
AnswerA

Correct: head -n 15 shows the first 15 lines.

Why this answer

head -n 15 filename displays the first 15 lines of a file.

101
Multi-Selectmedium

An administrator wants to gather information about disk usage for a specific directory and its subdirectories. Which TWO commands can be used for this purpose? (Choose two.)

Select 2 answers
A.du -sh /path
B.df -h /path
C.ls -lh /path
D.du -h /path
E.stat /path
AnswersA, D

Summarizes total disk usage of the directory.

Why this answer

du -sh /path gives a summary of total disk usage. du -h /path shows disk usage for each subdirectory in human-readable format. df shows filesystem-level usage, not directory-level.

102
MCQhard

A file has permissions rwxr-x--- and is owned by user alice and group devs. Which command would add the SUID bit while preserving existing permissions?

A.chmod a+s file
B.chmod u+s file
C.chmod 2755 file
D.chmod 4750 file
AnswerB

Adds SUID bit without altering other permissions.

Why this answer

chmod u+s adds the SUID bit. The symbolic mode 'u+s' sets the SUID without changing the existing permission bits.

103
Multi-Selectmedium

An administrator needs to update the package cache and upgrade all installed packages on a Debian-based system. Which TWO commands are appropriate for this task? (Select TWO.)

Select 2 answers
A.apt dist-upgrade
B.apt update
C.apt upgrade
D.dpkg --configure -a
E.apt list --upgradable
AnswersB, C

Updates the package index.

Why this answer

apt update refreshes the package cache; apt upgrade upgrades all packages. apt-get update and apt-get upgrade are also valid. The question asks for two commands; typically the sequence is update then upgrade. Both apt and apt-get are acceptable.

104
MCQmedium

A technician is troubleshooting a service that fails to start at boot. Which systemctl command should be used to ensure the service starts automatically on subsequent boots?

A.systemctl mask service
B.systemctl start service
C.systemctl enable service
D.systemctl reenable service
AnswerC

Enables the service to start at boot.

Why this answer

systemctl enable creates symlinks so the service starts at boot. The status shown by is-enabled confirms if it is enabled.

105
MCQhard

A system administrator needs to set the umask so that newly created files have permissions of 644 and directories have permissions of 755. Which umask value should be set?

A.0222
B.0022
C.000
D.077
AnswerB

Correct: umask 022 subtracts group and others write permission, resulting in 644 for files and 755 for directories.

Why this answer

Default base permissions are 666 for files and 777 for directories. To get 644 (rw-r--r--) for files: 666 - 644 = 022. To get 755 (rwxr-xr-x) for directories: 777 - 755 = 022.

So umask 022 works for both.

106
Multi-Selecthard

A system administrator is investigating a performance issue. Which THREE commands can be used to monitor running processes in real-time? (Select THREE).

Select 3 answers
A.zgrep
B.cat
C.zcat
D.less
E.zless
AnswersA, C, E

zgrep searches within compressed files.

Why this answer

The commands zcat, zless, and zgrep are specifically designed to display the contents of compressed files without decompressing them. zcat outputs the decompressed file to stdout, zless allows interactive viewing, and zgrep searches within compressed files. In contrast, cat and less cannot directly handle compressed files and would output binary garbage or fail.

107
MCQhard

Given an ACL entry 'u:john:rwx' on a file, which command would remove only the ACL entry for user john without affecting other ACL entries?

A.setfacl -k /path/to/file
B.setfacl -m u:john:- /path/to/file
C.setfacl -x u:john /path/to/file
D.setfacl -b /path/to/file
AnswerC

-x removes the specified entry.

Why this answer

setfacl -x removes a specific ACL entry. The syntax 'u:john' removes the ACL for user john.

108
MCQeasy

A Linux administrator needs to change the permissions of a file to be readable and writable by the owner, readable by the group, and no access for others. Which command accomplishes this?

A.chmod 600 file
B.chmod 664 file
C.chmod 644 file
D.chmod 640 file
AnswerD

Correct: 640 gives owner rw, group r, others none.

Why this answer

The octal representation 640 sets owner read/write (6), group read (4), and others none (0).

109
MCQhard

A system running systemd is failing to boot properly. The administrator wants to boot into an environment with only the essential services for troubleshooting. Which systemd target should be selected at boot?

A.multi-user.target
B.emergency.target
C.rescue.target
D.graphical.target
AnswerC

Correct: rescue.target provides a single-user shell with basic services.

Why this answer

rescue.target starts a minimal system with root filesystem mounted read-only and basic services.

110
Multi-Selecteasy

Which of the following commands can be used to display the contents of a file one page at a time? (Choose two.)

Select 2 answers
A.less
B.head
C.cat
D.tail
E.more
AnswersA, E

Correct: less is a pager.

Why this answer

The `less` command is a pager that displays file contents one screen at a time, allowing both forward and backward navigation. It is designed for viewing large files interactively, loading only the visible portion into memory for efficiency.

Exam trap

The trap here is that candidates may confuse `cat` as a pagination tool because it displays file contents, but it lacks any paging or interactive control, while `head` and `tail` are often mistakenly thought to paginate because they show a subset of lines.

111
MCQmedium

A system administrator wants to ensure that a service starts automatically at boot time using systemd. Which command should be used?

A.systemctl start service
B.systemctl daemon-reload
C.systemctl reenable service
D.systemctl enable service
AnswerD

Correct: enable sets the service to start at boot.

Why this answer

systemctl enable creates symlinks to make the service start at boot.

112
MCQmedium

A user wants to run a command that will continue running even after the user logs out. Which command should be used?

A.disown command
B.command &
C.bg command
D.nohup command &
AnswerD

Correct: nohup prevents the command from being terminated on logout, & backgrounds it.

Why this answer

nohup makes the command immune to hangups and runs in the background.

113
Multi-Selectmedium

A system administrator wants to display a list of all currently running processes, including those of other users, with full command lines. Which TWO commands can achieve this? (Select TWO.)

Select 2 answers
A.pstree
B.top
C.ps aux
D.htop
E.ps -ef
AnswersC, E

Correct: shows all processes with user info and full command line.

Why this answer

ps aux and ps -ef both show all processes with full command lines. top and htop show dynamic views but not in a static list format. pstree shows process tree.

114
MCQmedium

An administrator needs to view the last 20 lines of the systemd journal for the 'sshd' service. Which command should be used?

A.systemctl status sshd | tail -20
B.journalctl -u sshd -n 20
C.journalctl -u sshd --since '1 hour ago'
D.journalctl -u sshd -f
AnswerB

Correct: -u specifies unit, -n limits lines to 20.

Why this answer

journalctl -u sshd -n 20 shows the last 20 lines of the journal for the sshd unit.

115
MCQhard

A system administrator runs the command 'chmod 4755 /usr/local/bin/backup'. What effect does this have on the file?

A.Sets the sticky bit and gives rwxr-xr-x permissions
B.Sets the SUID bit and gives rwxr-xr-x permissions
C.Sets the SGID bit and gives rwxr-xr-x permissions
D.Sets the SUID bit and gives rwxrwxr-x permissions
AnswerB

SUID bit is set with 4xxx, permissions are 755.

Why this answer

The 4 in the first digit sets the SUID bit, so the file runs with the owner's permissions. 755 sets rwxr-xr-x.

116
MCQmedium

An administrator wants to display the last 20 lines of a log file and also write those lines to a file called recent.log. Which command should be used?

A.tail -n 20 file > recent.log
B.head -n 20 file > recent.log
C.cat file | head -n 20 > recent.log
D.tail -n 20 file | tee recent.log
AnswerD

Correct: tail outputs last 20 lines, tee sends to both stdout and recent.log.

Why this answer

tail -n 20 file | tee recent.log displays the last 20 lines and writes them to recent.log. tee is used to split output to file and stdout.

117
Multi-Selecthard

A technician needs to find all files in /home that have the SUID or SGID permission set. Which THREE commands can accomplish this? (Choose three.)

Select 3 answers
A.find /home -perm -4000 -o -perm -2000
B.find /home -perm -6000
C.find /home -perm /6000
D.find /home -perm 6000
E.find /home -type f -perm /4000 -o -type f -perm /2000
AnswersA, C, E

Combines -perm -4000 and -perm -2000 with OR.

Why this answer

find /home -perm /6000 matches files with either SUID (4000) or SGID (2000). -perm -4000 matches SUID only, -perm -2000 matches SGID only. The / notation matches any of the bits.

118
MCQmedium

A developer wants to change all occurrences of 'foo' to 'bar' in a configuration file and save the changes in-place. Which sed command should be used?

A.sed -i 's/foo/bar/' file
B.sed -n 's/foo/bar/p' file
C.sed 's/foo/bar/g' file
D.sed -i 's/foo/bar/g' file
AnswerD

Correct: -i enables in-place editing.

Why this answer

sed -i 's/foo/bar/g' file performs an in-place global substitution. The -i flag edits the file directly.

119
MCQmedium

An administrator needs to find the line number of the first occurrence of the string 'ERROR' in a log file, ignoring case. Which command is most appropriate?

A.grep -n 'ERROR' logfile
B.sed -n '/ERROR/=' logfile
C.awk '/ERROR/ {print NR}' logfile
D.grep -in 'error' logfile
AnswerD

-i for case insensitive, -n for line numbers.

Why this answer

grep -in 'error' logfile will output the line numbers with matches, ignoring case. The first line will be shown first if no other sorting is applied.

120
Multi-Selectmedium

A Linux administrator needs to add an ACL entry to grant read permission to a user named 'jdoe' on a file. Which TWO commands can be used to achieve this? (Select TWO).

Select 2 answers
A.setfacl -m u:jdoe:r file
B.setfacl --modify u:jdoe:r file
C.chown jdoe file
D.setfacl -x u:jdoe file
E.chmod u+r file
AnswersA, B

This adds an ACL entry for user jdoe with read permission.

Why this answer

Both setfacl -m and setfacl --modify can be used to modify ACLs. The -m option is the short form, and --modify is the long form.

121
MCQeasy

Which directory in the Linux filesystem contains essential user command binaries that are needed for booting and repairing the system?

A./usr/bin
B./bin
C./sbin
D./opt
AnswerB

Correct: /bin contains essential binaries like ls, cp, etc., needed during boot.

Why this answer

/bin contains essential command binaries required for booting and recovery.

122
MCQmedium

An administrator notices that a service named 'httpd' is not running. They want to check its current status and, if inactive, start it. Which set of systemctl commands should be used?

A.systemctl list-units httpd; if inactive, systemctl run httpd
B.systemctl show httpd; if inactive, systemctl launch httpd
C.systemctl is-active httpd; if inactive, systemctl enable httpd
D.systemctl status httpd; if inactive, systemctl start httpd
AnswerD

Correct sequence.

Why this answer

systemctl status httpd shows the status; if inactive, systemctl start httpd starts it. The other options have incorrect commands or syntax.

123
MCQmedium

An administrator wants to find all files in the current directory tree that are larger than 100 MB and have the .log extension. Which find command will accomplish this?

A.find . -name '*.log' -size +100M
B.find . -name '*.log' -size +100MB
C.find . -name '*.log' -size -100M
D.find . -type f -size +100M
AnswerA

Correct: finds .log files larger than 100 MB.

Why this answer

-size +100M finds files larger than 100 MB; -name '*.log' matches .log extension. Option A uses -type f but missing -name. Option B has -size +100MB (should be M).

Option D uses -size -100M (smaller).

124
MCQeasy

Which command is used to display the contents of a compressed log file without decompressing it?

A.head
B.zcat
C.cat
D.less
AnswerB

zcat reads compressed files and outputs to stdout.

Why this answer

zcat is used to view compressed files; it is equivalent to gunzip -c.

125
Multi-Selecteasy

A user wants to view the contents of a text file one page at a time. Which two commands can be used? (Choose two.)

Select 2 answers
A.less
B.cat
C.tail
D.head
E.more
AnswersA, E

less is a pager with backward and forward navigation.

Why this answer

less and more are pagers that display content one screen at a time.

126
MCQmedium

A Linux administrator needs to find all files in /var/log that have been modified within the last 7 days and are larger than 10 MB. Which find command accomplishes this?

A.find /var/log -mtime -7 -size +10M
B.find /var/log -atime -7 -size +10M
C.find /var/log -mtime +7 -size -10M
D.find /var/log -mmin -10080 -size +10M
AnswerA

Correct: -mtime -7 for last 7 days, -size +10M for larger than 10 MB.

Why this answer

The -mtime -7 option matches files modified less than 7 days ago, and -size +10M matches files larger than 10 MB.

127
MCQhard

A technician needs to replace all occurrences of '192.168.1.' with '10.0.0.' in the file /etc/network/interfaces and save the changes. Which command accomplishes this?

A.awk '{gsub(/192.168.1./,"10.0.0.");print}' /etc/network/interfaces > tmp && mv tmp /etc/network/interfaces
B.sed -i 's/192\.168\.1/10.0.0/g' /etc/network/interfaces
C.sed 's/192.168.1./10.0.0./g' /etc/network/interfaces > /etc/network/interfaces
D.sed -i 's/192.168.1./10.0.0./g' /etc/network/interfaces
AnswerD

Correct use of -i for in-place substitution.

Why this answer

sed -i 's/192\.168\.1\./10.0.0./g' /etc/network/interfaces uses in-place editing with the substitute command globally.

128
MCQeasy

Which directory in the Filesystem Hierarchy Standard (FHS) contains essential user commands available to all users, such as 'ls' and 'cp'?

A./sbin
B./opt
C./bin
D./usr/bin
AnswerC

Correct: /bin holds essential user commands.

Why this answer

/bin contains essential user binaries. /sbin is for system binaries (usually root). /usr/bin contains non-essential user binaries. /opt is for optional software.

129
MCQmedium

A technician needs to replace the string 'old_config' with 'new_config' in the file /etc/app.conf and save the changes in place. Which sed command accomplishes this?

A.sed -i 's/old_config/new_config/g' /etc/app.conf
B.sed 's/old_config/new_config/' /etc/app.conf
C.sed -n 's/old_config/new_config/p' /etc/app.conf
D.sed -i 's/old_config/new_config/' /etc/app.conf
AnswerA

Correct usage of in-place substitution globally.

Why this answer

The -i flag edits the file in place, and the s///g substitution replaces all occurrences.

130
MCQhard

An administrator wants to change the default systemd target to multi-user.target so the system boots to a text console. Which command should be used?

A.systemctl isolate multi-user.target
B.systemctl set-default multi-user.target
C.systemctl enable multi-user.target
D.systemctl mask multi-user.target
AnswerB

Correct command to set default target.

Why this answer

systemctl set-default multi-user.target sets the default target. systemctl isolate changes the current target but not the default. enable and mask are for services, not targets.

131
MCQhard

An administrator is troubleshooting a boot issue. The system boots to a console with limited functionality. Which systemd target should be used to bring up the system with network and multi-user support?

A.emergency.target
B.graphical.target
C.rescue.target
D.multi-user.target
AnswerD

Correct: multi-user.target boots to a text console with network.

Why this answer

multi-user.target provides a non-graphical multi-user system with network.

132
Multi-Selectmedium

An administrator needs to grant read and write access to the 'developers' group on a directory while preserving existing permissions for the owner and others. Which TWO commands can be used to modify ACLs? (Choose two.)

Select 1 answer
A.chmod g+rw /dir
B.getfacl /dir
C.setfacl -m u:developers:rw /dir
D.setfacl -x g:developers /dir
E.setfacl -m g:developers:rw /dir
AnswersE

Correct: modifies ACL to grant rw to group.

Why this answer

setfacl -m g:developers:rw sets ACL entry. getfacl displays ACLs but does not modify. chmod changes standard permissions, not ACLs. setfacl -x removes ACLs. setfacl -b removes all ACLs.

133
MCQhard

A technician needs to create a new ext4 filesystem on /dev/sdb1 and mount it persistently at /mnt/data. Which set of commands accomplishes this?

A.mkfs -t ext4 /dev/sdb1; mount /dev/sdb1 /mnt/data; echo '/dev/sdb1 /mnt/data ext4 defaults 0 2' >> /etc/fstab
B.mkfs.ext4 /dev/sdb1; echo '/dev/sdb1 /mnt/data ext4 defaults 0 2' >> /etc/fstab; mount -a
C.mkfs.ext4 /dev/sdb1; mount /dev/sdb1 /mnt/data
D.echo '/dev/sdb1 /mnt/data ext4 defaults 0 2' >> /etc/fstab; mount -a
E.fdisk /dev/sdb1; mount /dev/sdb1 /mnt/data; echo '/dev/sdb1 /mnt/data ext4 defaults 0 2' >> /etc/fstab
AnswerB

Correct sequence.

Why this answer

mkfs.ext4 /dev/sdb1 creates the filesystem. Adding an entry to /etc/fstab ensures persistent mount. mount -a mounts all filesystems in fstab.

134
Multi-Selecteasy

An administrator needs to create a hard link to an existing file. Which two statements are true about hard links? (Choose two.)

Select 2 answers
A.Hard links can be created for directories
B.Hard links can be created across different filesystems
C.Hard links are indistinguishable from the original file
D.Hard links share the same inode number
E.Deleting the original file removes the hard link
AnswersC, D

They are additional directory entries pointing to the same data.

Why this answer

Hard links share the same inode and cannot span filesystems. They cannot link to directories.

135
MCQeasy

An administrator wants to find all files larger than 100MB in the /var directory. Which command should be used?

A.find /var -size +100kb
B.find /var -type f -size +100M
C.ls -l /var | grep 100M
D.du -sh /var/* | grep M
AnswerB

This command finds files larger than 100MB.

Why this answer

The find command with -size +100M correctly locates files larger than 100MB.

136
MCQhard

A system administrator is troubleshooting a service that fails to start at boot. The system uses systemd. Which of the following commands would the administrator use to check the service's status and view its recent log entries?

A.journalctl -u service -n 50 && systemctl is-active service
B.systemctl status service && journalctl -n 50
C.systemctl list-units --state=failed && journalctl -p err
D.systemctl is-active service && journalctl -n 50
AnswerB

Correct: status shows service state and recent logs; journalctl -n 50 shows last 50 lines.

Why this answer

The correct answer is B. 'systemctl status service' displays detailed status of the service, including recent logs. 'journalctl -n 50' shows the last 50 journal entries. Together, they provide both status and recent logs. Option A uses 'systemctl is-active', which only returns active/inactive, not detailed status.

Option C lists failed units and error-level logs, not specific to the service. Option D also uses 'systemctl is-active' (boolean) and 'journalctl -n 50' without focusing on the service. Therefore, B is the best choice.

137
MCQmedium

A process is consuming excessive CPU and needs to be terminated immediately. The PID is 1234. Which command will terminate the process with the most forceful signal?

A.kill -15 1234
B.kill -1 1234
C.kill -9 1234
D.kill -19 1234
AnswerC

Correct: SIGKILL immediately terminates.

Why this answer

kill -9 (SIGKILL) forcibly terminates the process. SIGTERM (15) is graceful; SIGHUP (1) reloads config; SIGSTOP (19) suspends.

138
Multi-Selectmedium

A system administrator needs to monitor real-time process information and system resource usage. Which two commands can be used for this purpose? (Choose two.)

Select 2 answers
A.kill
B.top
C.htop
D.jobs
E.ps aux
AnswersB, C

top shows real-time process list and resource usage.

Why this answer

top and htop are interactive process viewers that show real-time updates.

139
MCQeasy

Which command is used to display the current process hierarchy in a tree format?

A.pstree
B.lsproc
C.ps aux
D.top
AnswerA

pstree displays processes in a tree hierarchy.

Why this answer

ps aux shows all processes with details, but pstree shows them in a tree format, which is useful for visualizing parent-child relationships.

140
MCQmedium

Which command will display the disk usage of each directory in the current directory, in human-readable format?

A.du -h
B.fdisk -l
C.ls -lh
D.df -h
AnswerA

Correct: du -h displays disk usage for directories in human-readable format.

Why this answer

The `du -h` command displays disk usage for each directory in the current directory, with the `-h` flag converting sizes into human-readable formats (e.g., K, M, G). This is the correct tool for per-directory disk usage reporting.

Exam trap

The trap here is that candidates confuse `df -h` (filesystem-level usage) with `du -h` (directory-level usage), often picking `df -h` because it also shows human-readable output.

How to eliminate wrong answers

Option B is wrong because `fdisk -l` lists partition tables on block devices, not directory-level disk usage. Option C is wrong because `ls -lh` lists file and directory names with sizes, but it does not compute recursive disk usage for directories. Option D is wrong because `df -h` shows filesystem-level free and used space, not per-directory usage.

141
MCQeasy

Which command displays the disk usage of files and directories in a human-readable format (e.g., KB, MB)?

A.df -h
B.ls -lh
C.stat -h
D.du -h
AnswerD

du -h shows disk usage of files/directories with human-readable sizes.

Why this answer

The `du -h` command (disk usage with human-readable flag) recursively summarizes disk usage for files and directories, appending size suffixes like K, M, G for kilobytes, megabytes, and gigabytes. This directly matches the question's requirement to display disk usage in a human-readable format.

Exam trap

The trap here is that candidates confuse `df -h` (filesystem-level free space) with `du -h` (per-file/directory disk usage), or assume `ls -lh` shows disk usage when it actually shows logical file size, not the blocks consumed on disk.

How to eliminate wrong answers

Option A is wrong because `df -h` reports filesystem-level disk space usage (free/used blocks on mounted partitions), not the disk usage of individual files and directories. Option B is wrong because `ls -lh` lists file sizes in human-readable format but does not compute or display disk usage (the actual blocks consumed on disk), which can differ from file size due to sparse files or block allocation. Option C is wrong because `stat -h` is not a valid Linux command; `stat` uses `-c` or `--format` for custom output and does not have a `-h` flag for human-readable sizes.

142
MCQhard

An administrator needs to apply a set of permissions to an existing directory and all its contents, setting the owner to 'rwx', group to 'rx', and others to '---'. Additionally, newly created files within the directory should inherit the group. Which commands should the administrator run? (Assume the directory is /data, and the group is 'staff'.)

A.chmod -R 750 /data; chmod g+s /data
B.chmod 750 /data; chmod g+s /data
C.chmod -R 755 /data; chmod g+s /data
D.chmod -R 750 /data
AnswerA

Correct: 750 grants rwxr-x---; chmod g+s sets SGID on directory.

Why this answer

chmod -R 750 /data sets permissions recursively. chmod g+s /data sets the SGID bit so new files inherit the group. The other options are missing SGID or have wrong permissions.

143
MCQmedium

A user wants to create a symbolic link to a file named 'original' in their home directory. Which command creates a symbolic link named 'link'?

A.ln original link
B.ln -s original link
C.ln -s link original
D.symlink original link
AnswerB

Correct: -s for symbolic, original is target, link is name.

Why this answer

ln -s creates a symbolic link; order is target (existing file) then link name.

144
MCQhard

An administrator wants to display only the second field from a colon-delimited file named 'passwd' using a text processing tool. Which command will achieve this?

A.sed 's/:.*//' passwd
B.awk -F: '{print $2}' passwd
C.cut -d: -f2 passwd
D.grep -o '^[^:]*:[^:]*' passwd
AnswerB

Correct: awk sets delimiter and prints field 2.

Why this answer

awk -F: '{print $2}' passwd sets field separator to : and prints second field. cut -d: -f2 also works, but the options include awk. sed is for editing, not field extraction; grep is for pattern matching.

145
Multi-Selectmedium

A system administrator needs to remove all files in /tmp that have not been accessed in the last 30 days and are not owned by root. Which two commands, combined, could be used to accomplish this? (Select TWO).

Select 2 answers
A.find /tmp -atime +30 -not -user root -delete
B.find /tmp -mtime +30 -not -user root -delete
C.find /tmp -atime -30 -user root -delete
D.find /tmp -atime +30 -user root -exec rm {} \;
E.find /tmp -atime +30 -not -user root -exec rm {} \;
AnswersA, E

Correct: uses -delete instead of -exec rm, also works.

Why this answer

find with -atime and -not -user root locates files; then use -exec rm or -delete to remove.

146
MCQmedium

An administrator needs to give a user read and write access to a file without changing the file's group or adding the user to any group. Which method should be used?

A.chown user: file
B.chmod u+rw file
C.setfacl -m u:username:rw file
D.chgrp to user's primary group
AnswerC

ACL allows specific user permissions without changing group.

Why this answer

Access Control Lists (ACLs) allow setting permissions for specific users beyond the traditional owner/group/others model, without changing group membership.

147
Multi-Selectmedium

A user has a file with permissions set to 644. Which of the following commands will add the setuid permission to the file? (Choose two.)

Select 2 answers
A.chmod u+s file
B.chmod g+s file
C.chmod 1644 file
D.chmod 4644 file
E.chmod 2644 file
AnswersA, D

Correct: symbolic mode for setuid.

Why this answer

chmod u+s file adds setuid via symbolic. chmod 4644 file sets permissions to rwsr--r-- (setuid). The other options: chmod 2644 sets SGID; chmod 1644 sets sticky bit; chmod g+s sets SGID.

148
MCQeasy

Which command displays the current umask value in symbolic mode?

A.umask
B.umask --symbolic
C.umask -S
D.umask -s
AnswerC

Correct. umask -S shows symbolic mode.

Why this answer

umask -S displays the umask in symbolic (rwx) format. The plain umask shows octal.

149
MCQmedium

An administrator needs to replace all occurrences of 'oldhost' with 'newhost' in the configuration file /etc/hosts. Which command will perform the replacement and save the changes directly to the file?

A.sed 's/oldhost/newhost/g' /etc/hosts
B.awk '{gsub(/oldhost/,"newhost")}1' /etc/hosts
C.grep -r 'oldhost' /etc/hosts | sed 's/oldhost/newhost/g'
D.sed -i 's/oldhost/newhost/g' /etc/hosts
AnswerD

Correct: -i edits file in-place, s/oldhost/newhost/g replaces all occurrences.

Why this answer

Option D is correct because the `-i` flag (in-place editing) tells `sed` to write the changes directly back to the file specified. Without `-i`, `sed` only prints the modified output to stdout and does not alter the original file. The substitution command `s/oldhost/newhost/g` performs a global replacement of all occurrences of 'oldhost' with 'newhost' on each line.

Exam trap

The trap here is that candidates often forget the `-i` flag for in-place editing, assuming `sed` modifies the file by default, or they confuse `sed`'s stream behavior with editors like `vim` that directly change the file.

How to eliminate wrong answers

Option A is wrong because it omits the `-i` flag, so the replacement is performed on the stream and printed to stdout, but the original /etc/hosts file remains unchanged. Option B is wrong because `awk` by default writes to stdout only; it does not have an in-place editing flag, so the file is not saved. Option C is wrong because `grep -r` recursively searches for 'oldhost' in /etc/hosts (which is a single file, not a directory) and pipes matching lines to `sed`, but `sed` again lacks `-i` and the pipeline only processes matched lines, not the entire file, so the original file is not modified.

150
MCQmedium

A file has permissions set to 2755. Which special permission is enabled, and what does it do?

A.SGID; new files in the directory inherit the group
B.No special permission; it is just octal 755
C.Sticky bit; only file owners can delete their files
D.SUID; the file runs with the owner's privileges
AnswerA

Correct: SGID on directories.

Why this answer

The permission 2755 includes the SGID (Set Group ID) special permission, indicated by the leading digit '2'. When SGID is set on a directory, new files and subdirectories created within it inherit the group ownership of the directory, rather than the primary group of the user who creates them. This is critical for collaborative environments where multiple users need shared group access.

Exam trap

Cisco often tests the distinction between the numeric representations of special permissions (1=sticky, 2=SGID, 4=SUID) and their specific effects on directories versus files, leading candidates to confuse SGID with SUID or the sticky bit.

How to eliminate wrong answers

Option B is wrong because the leading '2' in 2755 explicitly indicates a special permission (SGID) is set, not just octal 755. Option C is wrong because the sticky bit is represented by a leading '1' (e.g., 1755), not '2', and it restricts file deletion to owners, not group inheritance. Option D is wrong because SUID is represented by a leading '4' (e.g., 4755), and it applies to executable files to run with the owner's privileges, not to directories for group inheritance.

← PreviousPage 2 of 3 · 153 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Lxp System Management questions.