Unit 4: Command Productivity, Scheduling, Performance, and ACLs - Practice Quiz

CSE493 — Linux System Administration 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 Which keyboard shortcut usually moves the cursor to the beginning of the command line in Bash?

Improving Command-line Productivity Easy
A. Ctrl+K
B. Ctrl+E
C. Ctrl+U
D. Ctrl+A

2 Which command displays the commands previously entered in a Bash shell?

Improving Command-line Productivity Easy
A. history
B. commands
C. recall
D. past

3 Which character is commonly used at the beginning of a Bash script to identify its interpreter?

Writing Simple Bash Scripts Easy
A. //
B. $$
C. #!
D. ##

4 Which command makes a Bash script executable for its owner?

Writing Simple Bash Scripts Easy
A. exec u+x script.sh
B. chmod u+x script.sh
C. run u+x script.sh
D. chown u+x script.sh

5 Which Bash loop is commonly used to process each item in a list?

Running Commands More Efficiently Using Loops Easy
A. case
B. until
C. for
D. select

6 What is the main purpose of a loop in a Bash script?

Running Commands More Efficiently Using Loops Easy
A. Repeat commands
B. Mount filesystems
C. Change ownership
D. Create users

7 Which command is commonly used to search for text patterns in command output?

Matching Text in Command Output with Regular Expressions Easy
A. sort
B. grep
C. cut
D. wc

8 In a basic regular expression, what does the character ^ usually represent?

Matching Text in Command Output with Regular Expressions Easy
A. A repeated word
B. Any single character
C. End of a line
D. Start of a line

9 Which Linux command displays the current date and time?

Scheduling Future Tasks Easy
A. clock
B. calendar
C. date
D. time-now

10 Which command schedules a command to run once at a specified future time?

Scheduling a Deferred User Job Easy
A. at
B. cron
C. batcher
D. watch

11 Which command lists a user's pending at jobs?

Scheduling a Deferred User Job Easy
A. atlist
B. atq
C. jobs-at
D. atrm

12 Which service is commonly used to run commands on a recurring schedule in Linux?

Scheduling Recurring System Jobs Easy
A. rsync
B. sudo
C. ssh
D. cron

13 Which command edits a user's personal crontab?

Scheduling Recurring System Jobs Easy
A. cronedit -u
B. schedule -e
C. jobtab --edit
D. crontab -e

14 Which directory commonly stores temporary files on a Linux system?

Managing Temporary Files Easy
A. /tmp
B. /boot
C. /home
D. /opt

15 Which command is designed to create a temporary file or directory safely?

Managing Temporary Files Easy
A. touchtmp
B. newfile
C. tmpcreate
D. mktemp

16 Which command provides a real-time view of running processes and resource usage?

Tuning System Performance Easy
A. top
B. ls
C. df
D. uname

17 What is the purpose of a system tuning profile?

Adjusting Tuning Profiles Easy
A. List network cables
B. Store user passwords
C. Compile kernel modules
D. Group performance settings

18 Which command can start a program with a modified CPU scheduling priority?

Influencing Process Scheduling Easy
A. renice-start
B. schedrun
C. priority
D. nice

19 What does an access control list (ACL) provide for a file?

Controlling Access to Files with ACLs Easy
A. Automatic file compression
B. Detailed access permissions
C. A new filename
D. Faster disk rotation

20 Which command displays the ACL entries for a file?

Interpreting File ACLs Easy
A. getfacl
B. readperm
C. showacl
D. lsacl

21 You previously executed a long command containing journalctl and now want to find and reuse it without scrolling through the history list. Which keyboard action is most efficient?

Improving Command-line Productivity Medium
A. Press Ctrl+C and type the entire command again
B. Press Ctrl+R and type part of the command
C. Press Ctrl+Z and inspect the shell's background jobs
D. Press Ctrl+D and search the history file manually

22 Which command uses brace expansion to copy report to report.bak?

Improving Command-line Productivity Medium
A. cp report report.bak && manually verify that both file names were expanded by the shell
B. cp report[.bak]
C. cp report{,.bak}
D. cp report(.bak)

23 A script contains cp -- "$1" "$1.bak". What is the primary purpose of -- in this command?

Writing Simple Bash Scripts Medium
A. It forces Bash to expand all positional parameters before executing cp
B. It causes cp to run in the background
C. It enables recursive directory copying
D. It marks the end of command options

24 You need to compress every .log file in the current directory, including files whose names contain spaces. Which loop is appropriate?

Running Commands More Efficiently Using Loops Medium
A. for file in "*.log"; do gzip -- $file; done
B. for file in *.log; do gzip -- "$file"; done
C. for file in $(ls *.log); do gzip $file; done
D. while file=*.log; do gzip "$file"; done

25 Which command displays only lines that consist of ERROR, followed by whitespace, followed by exactly three digits?

Matching Text in Command Output with Regular Expressions Medium
A. grep -E 'ERROR[[:space:]]*[0-9]+$' app.log
B. grep -E '^ERROR.*[0-9]{3}' app.log
C. grep -E '^ERROR[[:space:]]+[0-9]{3}$' app.log
D. grep '^ERROR [0-9]{3}' app.log

26 A log uses prefixes such as WARN: and ERROR:. Which command selects lines beginning with either of these prefixes?

Matching Text in Command Output with Regular Expressions Medium
A. grep -E '^WARN&ERROR:' system.log
B. grep -E '[WARN|ERROR]:' system.log
C. grep '^WARN|ERROR:' system.log
D. grep -E '^(WARN|ERROR):' system.log

27 A report command must run once at the next occurrence of 22:30. Which command schedules it correctly?

Scheduling Future Tasks Medium
A. cron 22:30 /usr/local/bin/report
B. at --repeat 22:30 /usr/local/bin/report
C. echo '/usr/local/bin/report' | at 22:30
D. sleep 22:30 && /usr/local/bin/report

28 An at job with ID 12 was scheduled by mistake. Which sequence lists the pending jobs and then removes that job?

Scheduling a Deferred User Job Medium
A. atq followed by atrm 12
B. crontab -l followed by crontab -r 12
C. systemctl list-jobs followed by systemctl cancel 12
D. jobs followed by kill 12

29 Which crontab entry runs /usr/local/bin/backup at 02:15 every Monday through Friday?

Scheduling Recurring System Jobs Medium
A. 15 2 1-5 * * /usr/local/bin/backup
B. 2 15 * * 1-5 /usr/local/bin/backup
C. 15 2 * * 1-5 /usr/local/bin/backup
D. 15 2 * 1-5 * /usr/local/bin/backup

30 How does an entry in /etc/cron.d/ differ from an entry created with a user's crontab -e?

Scheduling Recurring System Jobs Medium
A. It uses seconds as the first scheduling field
B. It includes a username field before the command
C. It requires every command to be placed in a separate executable shell script
D. It can execute commands only once after startup

31 A script needs a unique private temporary directory and must avoid predictable names. Which command is most appropriate?

Managing Temporary Files Medium
A. workdir=/tmp/script-temp
B. workdir=$(mktemp -d)
C. mkdir /tmp/$$
D. touch /tmp/work && workdir=/tmp/work

32 An administrator adds d /run/myapp 0750 app app - to /etc/tmpfiles.d/myapp.conf. Which command creates the configured directory without waiting for a reboot?

Managing Temporary Files Medium
A. systemd-tmpfiles --clean
B. systemd-tmpfiles --create
C. systemctl daemon-reload
D. tmpwatch --create /run/myapp

33 Before choosing a Tuned profile, an administrator wants to see the profile recommended for the current system. Which command should be used?

Tuning System Performance Medium
A. tuned-adm recommend
B. tuned-adm active
C. tuned-adm verify
D. tuned-adm profile

34 A server running latency-sensitive applications must be switched to the latency-performance Tuned profile. Which command performs the change?

Adjusting Tuning Profiles Medium
A. tuned-adm active latency-performance
B. tuned-adm off && sysctl latency-performance
C. tuned-adm recommend latency-performance
D. tuned-adm profile latency-performance

35 A CPU-intensive command should start with a lower scheduling priority than normal processes. Which command is suitable?

Influencing Process Scheduling Medium
A. nice -n -10 ./analyze-data
B. priority --low ./analyze-data
C. nice -n 10 ./analyze-data
D. renice 10 ./analyze-data

36 Process 4242 is already running and should be assigned a nice value of 15. Which command makes this adjustment?

Influencing Process Scheduling Medium
A. renice 15 -p 4242
B. renice -p 15 4242
C. chrt 15 -p 4242
D. nice 15 -p 4242

37 User maya needs read and write access to project.txt without changing the file's owner or group. Which command adds the required ACL entry?

Controlling Access to Files with ACLs Medium
A. chown maya project.txt && restore the original ownership after Maya finishes editing the file
B. chmod u+rw project.txt maya
C. setfacl -m g:maya:rw- project.txt
D. setfacl -m u:maya:rw- project.txt

38 Consider this ACL:

user::rw-

user:alice:rwx #effective:r-x

group::r--

mask::r-x

other::---

What permissions does Alice effectively have?

Interpreting File ACLs Medium
A. Read only
B. Read, write, and execute
C. Read and execute
D. Write and execute

39 New items created under /srv/project should inherit an ACL granting the developers group read, write, and execute permissions, subject to creation-mode restrictions. Which command configures this default ACL?

Securing Files with ACLs Medium
A. chmod -R g+rwx /srv/project
B. setfacl -m g:developers:rwx /srv/project
C. setfacl -m d:g:developers:rwx /srv/project
D. setfacl -m u:developers:rwx /srv/project

40 A contractor's named user ACL must be removed from plans.txt without deleting the file's other extended ACL entries. Which command should be used?

Securing Files with ACLs Medium
A. setfacl -x u:contractor plans.txt
B. chmod --remove-user contractor plans.txt
C. setfacl -b plans.txt
D. setfacl -k plans.txt

41 In an interactive Bash session, an administrator runs systemctl status sshd, then wants to run journalctl -u sshd without retyping sshd. Which command correctly reuses the final argument of the previous command?

Improving Command-line Productivity Hard
A. journalctl -u !^
B. journalctl -u !*
C. journalctl -u !!
D. journalctl -u !$

42 A Bash script must process every regular file below /srv/input, including filenames containing spaces, tabs, wildcard characters, or newlines. Which construct is safest?

Writing Simple Bash Scripts Hard
A. find /srv/input -type f -print0 | while IFS= read -r -d '' file; do process "$file"; done
B. find /srv/input -type f | while read file; do process $file; done
C. for file in /srv/input/**/*; do process $file; done
D. for file in $(find /srv/input -type f); do process "$file"; done

43 A script starts with set -e. Which statement best explains why set -e alone cannot guarantee that the script stops after every failed command?

Writing Simple Bash Scripts Hard
A. Failures from external commands are ignored unless set -u is enabled.
B. Failures are detected only when the script is invoked with bash -x.
C. Failures in pipelines always terminate the script regardless of pipefail.
D. Failures used as conditions in constructs such as if and while may be exempt from immediate exit.

44 An administrator wants to create accounts from a Bash array whose elements may contain spaces. Which loop preserves each array element as exactly one argument?

Running Commands More Efficiently Using Loops Hard
A. for user in ${users[@]}; do create_user "$user"; done
B. for user in $(printf '%s ' "${users[@]}"); do create_user "$user"; done
C. for user in "${users[*]}"; do create_user "$user"; done
D. for user in "${users[@]}"; do create_user "$user"; done

45 A command emits records such as ERROR[17]: disk full. Which extended regular expression matches only complete lines beginning with ERROR, followed by a nonempty decimal code in brackets, a colon, one space, and any message?

Matching Text in Command Output with Regular Expressions Hard
A. ^ERROR\([0-9]+\): .*$
B. ^ERROR[[0-9]+]: .+$
C. ERROR\[[0-9]*\]: .*
D. ^ERROR\[[0-9]+\]: .*$

46 An administrator runs grep -E '^(ab|cd){2}$'. Which input line is matched?

Matching Text in Command Output with Regular Expressions Hard
A. abcd
B. ab|cd
C. abcc
D. ababcd

47 A one-time maintenance command must run only when the system load average is low enough, rather than at an exact clock time. Which scheduling mechanism is designed for this requirement?

Scheduling Future Tasks Hard
A. Install it in an hourly cron entry.
B. Submit the command with batch.
C. Start it with a negative nice value.
D. Submit the command with at now.

48 A user submits at 02:00 while located in /srv/reports and with umask 027. Assuming the job is accepted, which execution behavior should normally be expected?

Scheduling a Deferred User Job Hard
A. The job restores the directory but always applies a fixed umask of 022.
B. The job starts in the user's home directory with the daemon's umask.
C. The job restores the submission directory and submitted umask when it runs.
D. The job starts in / and reads the current interactive shell settings.

49 A crontab entry must pass the literal argument 50% to a command. Which entry avoids cron treating % as a newline that sends following text to standard input?

Scheduling Recurring System Jobs Hard
A. 5 * * * * /usr/local/bin/report 50%%
B. 5 * * * * /usr/local/bin/report "50%"
C. 5 * * * * /usr/local/bin/report 50\%
D. 5 * * * * /usr/local/bin/report '50%'

50 A systemd timer should run a cleanup service daily and should trigger soon after boot if the machine was powered off at the scheduled time. Which timer setting provides the catch-up behavior?

Scheduling Recurring System Jobs Hard
A. RandomizedDelaySec=0
B. Persistent=true
C. RemainAfterElapse=true
D. AccuracySec=1s

51 A service needs /run/acme recreated at every boot with mode 0750, owner acme, and group acme. Which tmpfiles.d entry expresses this requirement?

Managing Temporary Files Hard
A. d /run/acme 0750 acme acme -
B. v /run/acme 0750 acme root -
C. f /run/acme 0750 acme acme -
D. D /run/acme 0750 root acme 1d

52 A tmpfiles.d rule contains d /var/cache/acme 0755 acme acme 7d. What does the 7d field primarily control?

Managing Temporary Files Hard
A. Expiration of the directory's ownership after seven days
B. Removal of the directory exactly seven days after creation
C. Age-based cleanup of eligible contents under the directory
D. Recreation of the directory once every seven days

53 After selecting a Tuned profile, an administrator manually changes a kernel tunable that the profile manages. The value later reverts. What is the best explanation?

Tuning System Performance Hard
A. Cron periodically replaces all runtime values with package defaults.
B. The shell resets kernel tunables when the administrator's session ends.
C. Tuned may dynamically monitor and reapply settings declared by the active profile.
D. The kernel automatically restores every sysctl value from /etc/sysctl.conf.

54 A host currently uses a Tuned profile chosen automatically by recommendation logic. The administrator needs to activate throughput-performance explicitly. Which command performs that action?

Adjusting Tuning Profiles Hard
A. tuned-adm verify throughput-performance
B. tuned-adm active throughput-performance
C. tuned-adm recommend throughput-performance
D. tuned-adm profile throughput-performance

55 An unprivileged user owns a process currently running with nice value 10. Which renice request is normally permitted without additional capabilities?

Influencing Process Scheduling Hard
A. Change the nice value from 10 to 15.
B. Change the nice value from 10 to -5.
C. Change the nice value from 10 to 0.
D. Change the nice value from 10 to -20.

56 A backup process should perform disk I/O only when no other process is requesting I/O. Which command assigns the appropriate I/O scheduling class?

Influencing Process Scheduling Hard
A. ionice -c 2 -n 7 -p PID
B. renice 19 -p PID
C. ionice -c 3 -p PID
D. chrt --idle -p 0 PID

57 A file has the ACL entries user::rw-, user:alice:rwx, group::r--, mask::r-x, and other::---. Assuming Alice is not the file owner, what effective permissions does Alice receive from this ACL?

Interpreting File ACLs Hard
A. rwx
B. r--
C. ---
D. r-x

58 A file has a named ACL entry granting Alice rwx, and its mask is currently rwx. An administrator runs chmod g=r file. What is the likely effect on Alice's effective ACL permissions?

Controlling Access to Files with ACLs Hard
A. Alice receives --- because only the owning group can use the mask.
B. Alice retains effective rwx because named entries ignore group mode bits.
C. Alice loses her named entry because chmod removes all extended ACLs.
D. Alice's effective permissions become r-- because the ACL mask changes.

59 A shared directory must cause newly created files to inherit ACL permissions for group auditors, but it must not retroactively alter existing files. Which command addresses the inheritance requirement?

Securing Files with ACLs Hard
A. chmod g+s,g=rx /srv/shared
B. setfacl -m d:g:auditors:r-x /srv/shared
C. setfacl -m g:auditors:r-x /srv/shared
D. setfacl -R -m g:auditors:r-x /srv/shared

60 An administrator must copy a directory tree while preserving extended access ACLs, default ACLs, ownership, modes, timestamps, and symbolic links. Which command is most appropriate on systems where GNU cp supports ACL preservation through archive mode?

Securing Files with ACLs Hard
A. cp -r /srv/source/* /srv/destination/
B. cp -a /srv/source/. /srv/destination/
C. cp --no-preserve=mode -r /srv/source/. /srv/destination/
D. cp -Lr /srv/source/. /srv/destination/