Unit 5 - Practice Quiz

INT249 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 Which command is most commonly used to create a new, empty file or to update the modification timestamp of an existing file?

create and edit text files Easy
A. new
B. touch
C. create
D. make

2 Which of the following is a simple, beginner-friendly command-line text editor available on most Linux systems?

create and edit text files Easy
A. gedit
B. nano
C. vim
D. MS Word

3 Which command searches the entire file system for files and directories matching a specific name, size, or modification time?

search for files Easy
A. find
B. locate
C. grep
D. search

4 The locate command finds files very quickly because it searches...

search for files Easy
A. through network drives.
B. only in the current directory.
C. the kernel's memory.
D. a pre-built database of file paths.

5 Which command is used to create a new directory named mydocs?

perform operations on files and directories Easy
A. newdir mydocs
B. makedir mydocs
C. mkdir mydocs
D. crdir mydocs

6 To copy a file named report.txt to report_backup.txt, which command would you use?

perform operations on files and directories Easy
A. clone report.txt report_backup.txt
B. mv report.txt report_backup.txt
C. cp report.txt report_backup.txt
D. copy report.txt report_backup.txt

7 What command is used to search for lines containing a specific pattern within a text file?

process text files Easy
A. find
B. grep
C. locate
D. wc

8 Which command would you use to display only the last 10 lines of a file named logfile.log?

process text files Easy
A. last logfile.log
B. bottom logfile.log
C. tail logfile.log
D. head logfile.log

9 In the command ls -l > file_list.txt, what does the > character do?

manipulate file output Easy
A. Pipes the output to another command.
B. Appends the command output to the file.
C. Reads input for the command from the file.
D. Redirects standard output to a file, overwriting it.

10 Which operator should be used to add the output of a command to the end of a file without deleting its existing content?

manipulate file output Easy
A. >>
B. >
C. <
D. |

11 Which command is used to display basic information about the system's kernel, such as its version and release name?

explore the linux kernel Easy
A. kernel --version
B. ls /kernel
C. uname -r
D. sysinfo

12 The Linux kernel file itself is typically stored in which directory?

explore the linux kernel Easy
A. /home
B. /var
C. /boot
D. /etc

13 What is the recommended command for loading a kernel module and its dependencies?

install and configure kernel modules Easy
A. loadmod
B. addmod
C. modprobe
D. insmod

14 To remove a kernel module from the running kernel, which command would you use?

install and configure kernel modules Easy
A. rmmod
B. delmod
C. unload
D. mod-remove

15 Which command provides a formatted list of all currently loaded modules in the Linux kernel?

monitor kernel modules Easy
A. lsmod
B. modules
C. showmod
D. modlist

16 If you want to see detailed information about a specific kernel module file (like its author, license, and parameters), which command is used?

monitor kernel modules Easy
A. moddetails
B. modinfo
C. modstat
D. lsmod -v

17 What is the role of the initramfs during the boot process?

configure linux boot components Easy
A. It is the primary boot loader.
B. It is the main graphical interface.
C. It is a temporary root filesystem used to load drivers needed to mount the real root filesystem.
D. It stores permanent user data.

18 The very first process started by the Linux kernel, which has a Process ID (PID) of 1, is called:

configure linux boot components Easy
A. init
B. bash
C. bootd
D. kernel

19 To make a permanent change to the GRUB2 boot menu, such as setting the default OS, which file should you edit?

configure GRUB2 Easy
A. /etc/default/grub
B. /boot/menu.lst
C. /boot/grub/grub.cfg
D. /etc/grub.conf

20 After editing the /etc/default/grub file, what command must be run to apply the changes to the boot loader?

configure GRUB2 Easy
A. grub-install
B. save-grub
C. reboot
D. update-grub

21 You are editing a large configuration file named app.conf using vim. What is the most efficient command to find all occurrences of the string TIMEOUT=30 and replace them with TIMEOUT=60 throughout the entire file?

create and edit text files Medium
A. Press Esc, then type :%s/TIMEOUT=30/TIMEOUT=60/g and press Enter.
B. Press Esc, then type :g/TIMEOUT=30/s//TIMEOUT=60/ and press Enter.
C. Press Esc, then type :s/TIMEOUT=30/TIMEOUT=60/ and press Enter.
D. Press Esc, then type :/TIMEOUT=30 followed by cw, type TIMEOUT=60, and repeat for each occurrence.

22 You have a log file, access.log, where each line is a record. You want to display only the lines that contain the IP address 192.168.1.50 but do not contain the word POST. Which command would achieve this?

process text files Medium
A. cat access.log | grep '192.168.1.50' -o 'POST'
B. grep '192.168.1.50' && !grep 'POST' access.log
C. grep '192.168.1.50' access.log | grep -v 'POST'
D. grep '192.168.1.50' -v 'POST' access.log

23 A developer needs to find all C source files (*.c) in the /usr/src directory that have been modified in the last 10 days and are larger than 50 kilobytes. Which find command correctly implements this search?

search for files Medium
A. find /usr/src -name '*.c' -mtime -10 -size +50k
B. find /usr/src -name '*.c' AND -mtime < 10 AND -size > 50k
C. find /usr/src -file '*.c' -mtime 10 -size 50k
D. locate /usr/src '*.c' --mtime -10 --size +50k

24 You have a file named data.txt and you create a hard link to it named data_hardlink. You also create a symbolic link to it named data_symlink. What happens if you delete the original file, data.txt?

perform operations on files and directories Medium
A. Both data_hardlink and data_symlink become unusable.
B. The content is preserved and accessible via data_hardlink, but data_symlink becomes a broken link.
C. The file content is deleted, and both links become broken.
D. The content is preserved and accessible via data_symlink, but data_hardlink becomes a broken link.

25 You are running a script, backup.sh, that produces important status messages to standard output (stdout) and error messages to standard error (stderr). How can you redirect the status messages to backup.log and the error messages to errors.log in a single command?

manipulate file output Medium
A. ./backup.sh > backup.log 2> errors.log
B. ./backup.sh 1> backup.log 2>> backup.log
C. ./backup.sh &> backup.log
D. ./backup.sh > backup.log | tee errors.log

26 You need to permanently increase the GRUB2 boot menu timeout to 15 seconds and set the second menu entry (index 1) as the default boot option. After editing /etc/default/grub, which two lines should be correctly modified?

configure GRUB2 Medium
A. GRUB_TIMEOUT_STYLE=15 and GRUB_DEFAULT="1"
B. GRUB_TIMEOUT=15 and GRUB_DEFAULT=1
C. GRUB_WAIT=15 and GRUB_DEFAULT=2
D. GRUB_HIDDEN_TIMEOUT=15 and GRUB_DEFAULT_ENTRY=1

27 A new network card requires the e1000e kernel module, but it's not loading on boot. To ensure it loads automatically every time the system starts, what is the recommended method on a modern systemd-based Linux distribution?

install and configure kernel modules Medium
A. Run the command modprobe -s e1000e to make it permanent.
B. Edit the /boot/grub/grub.cfg file to add module=e1000e to the kernel line.
C. Add insmod e1000e to the /etc/rc.local file.
D. Create a file named net.conf in /etc/modules-load.d/ with the line e1000e.

28 You suspect the nouveau graphics driver module is causing system instability. Before unloading it, you want to see detailed information about it, including the file path, license, and any parameters it accepts. Which command provides this specific information?

monitor kernel modules Medium
A. lsmod | grep nouveau
B. modinfo nouveau
C. dmesg | grep nouveau
D. modprobe -c | grep nouveau

29 A system administrator needs to check the exact kernel command-line parameters that were used to boot the currently running system. Which file in the /proc filesystem contains this information?

explore the linux kernel Medium
A. /proc/kallsyms
B. /proc/cmdline
C. /proc/version
D. /proc/config.gz

30 After editing /etc/default/grub to change the default kernel boot parameters, the changes do not take effect on reboot. What crucial step was most likely missed?

configure linux boot components Medium
A. Running mount -o remount,rw /boot
B. Running systemctl restart grubd.service
C. Running grub2-mkconfig -o /boot/grub2/grub.cfg
D. Running touch /boot/grub2/grub.cfg

31 You need to extract the usernames (first column) and shells (last column) for all users whose user ID (third column) is greater than 1000 from the /etc/passwd file. Which awk command is best suited for this task?

process text files Medium
A. cat /etc/passwd | awk -F, '1, $7}'
B. awk 'BEGIN{FS=":"} if(3 > 1000) {print 1, 7}' /etc/passwd
C. awk -F: '1, $7}' /etc/passwd
D. awk '{if (1 $NF}' /etc/passwd

32 You want to create a compressed archive of the /var/log directory, naming it logs.tar.bz2. However, you need to exclude the journal subdirectory from the archive. Which tar command accomplishes this?

perform operations on files and directories Medium
A. tar -cjvf logs.tar.bz2 --exclude='/var/log/journal' /var/log
B. tar -xzvf logs.tar.bz2 /var/log --except=journal
C. tar -c /var/log | bzip2 --exclude='journal' > logs.tar.bz2
D. tar -cvf logs.tar.bz2 /var/log --ignore=journal

33 You are looking for a configuration file that you know contains the string ListenAddress, but you can't remember its name or exact location, though you suspect it's somewhere in /etc. Which command is most effective for finding the names of the files containing this string?

search for files Medium
A. grep -lR 'ListenAddress' /etc
B. cat /etc/* | grep 'ListenAddress'
C. locate ListenAddress | grep /etc
D. find /etc -exec grep 'ListenAddress' {} \;

34 You need to programmatically comment out a line containing LogLevel debug in a configuration file /etc/httpd/conf/httpd.conf using a single, non-interactive command. Which sed command would be appropriate for this in-place edit?

create and edit text files Medium
A. sed 's/LogLevel debug/##/' > /etc/httpd/conf/httpd.conf
B. sed -i 's/^LogLevel debug/#LogLevel debug/' /etc/httpd/conf/httpd.conf
C. sed -o '/LogLevel debug/d' /etc/httpd/conf/httpd.conf
D. echo '#LogLevel debug' >> /etc/httpd/conf/httpd.conf

35 What is the primary function of the tee command in a pipeline, as shown in the example: ps aux | tee process_list.txt | grep 'nginx'?

manipulate file output Medium
A. It redirects the standard output to a file and also to the next command in the pipeline.
B. It acts as a T-junction, sending standard error to process_list.txt and standard output to grep.
C. It filters the output of ps aux and writes only lines containing nginx to process_list.txt.
D. It appends the output of ps aux to process_list.txt and then displays it to the screen.

36 You need to access a Linux system to reset the root password. The standard procedure involves interrupting the boot process to add init=/bin/bash to the kernel parameters. Which key do you typically press at the GRUB2 menu to edit the selected boot entry for a single boot?

configure GRUB2 Medium
A. F10 to modify boot parameters
B. e to edit commands
C. Tab to edit options
D. c for command-line

37 What is the primary purpose of the initramfs (initial RAM filesystem) in the Linux boot process?

explore the linux kernel Medium
A. To contain essential kernel modules (like disk controller or filesystem drivers) needed to mount the actual root filesystem.
B. To permanently store the kernel image and device drivers.
C. To run a memory check (memtest) before the operating system loads.
D. To provide a user-space environment for running services before the real root filesystem is mounted.

38 What is the key advantage of using modprobe over insmod to load a kernel module?

install and configure kernel modules Medium
A. modprobe allows you to set module parameters, whereas insmod does not.
B. modprobe is a newer, faster version of insmod with identical functionality.
C. modprobe automatically resolves and loads any dependency modules that the requested module requires.
D. modprobe can load modules that are not located in the standard /lib/modules directory.

39 A system administrator runs the command lsmod and sees the following output snippet:


vboxguest 348160 2 vboxsf
vboxsf 40960 0


What does the number 2 in the vboxguest line signify?

monitor kernel modules Medium
A. The vboxsf module is dependent on vboxguest, and there is one other dependent module.
B. The module vboxguest is using two other modules.
C. The module has a use count of 2, meaning it is currently being used by two other modules or processes.
D. The module has been loaded twice.

40 You have compiled and installed a new custom kernel. To make it bootable, you need to update the bootloader configuration. Which command is most commonly used on modern Linux systems to automatically detect the new kernel and add it to the GRUB menu?

configure linux boot components Medium
A. update-grub or grub2-mkconfig -o /boot/grub2/grub.cfg
B. mkinitrd /boot/initramfs-new.img
C. grub2-install /dev/sda
D. efibootmgr -c -d /dev/sda -p 1 -L "New Kernel"

41 You need to modify /etc/config.conf in-place. You want to delete all lines containing the word "DEPRECATED", and on all remaining lines that start with "Listen", you want to change the first occurrence of "80" to "8080". Which sed command correctly and safely accomplishes this in the specified order?

create and edit text files Hard
A. cat /etc/config.conf | sed '/DEPRECATED/d' | sed '/^Listen/s/80/8080/' > /etc/config.conf
B. sed -i -e '/DEPRECATED/d' -e '/^Listen/s/80/8080/' /etc/config.conf
C. sed -i '/DEPRECATED/d; /^Listen/s/80/8080/g' /etc/config.conf
D. sed -i -e '/^Listen/s/80/8080/' -e '/DEPRECATED/d' /etc/config.conf

42 You are looking for all files in /var/log that are larger than 10MB, have been modified in the last 2 days, and contain the case-insensitive string "fatal error". For maximum efficiency, you want to minimize the number of processes created and avoid running grep on files that don't match the size and time criteria. Which find command is the most efficient and robust?

search for files Hard
A. grep -ril "fatal error" /var/log | xargs -I{} find {} -size +10M -mtime -2
B. find /var/log -type f -size +10M -mtime -2 | xargs grep -il "fatal error"
C. find /var/log -type f -size +10M -mtime -2 -print0 | xargs -0 grep -il "fatal error"
D. find /var/log -type f -size +10M -mtime -2 -exec grep -il "fatal error" {} +

43 Given a log file access.log with lines like 1.2.3.4 - - [10/Oct/2000:13:55:36 -0700] "GET /path/file.html HTTP/1.0" 404 2326. You want to count the number of requests for each IP address that resulted in a 404 status code. The final output must be sorted by count in descending order, showing only the top 5 IPs. Which command pipeline is correct?

process text files Hard
A. grep " 404 " access.log | awk '{print $1}' | sort | uniq | sort -rn | head -n 5
B. cat access.log | grep " 404 " | cut -d ' ' -f 1 | sort -n | uniq -c | head -n 5
C. awk '{if (1]++} END {for (ip in count) print count[ip], ip}' access.log | sort -rn | head -n 5
D. awk '1}' access.log | sort | uniq -c | sort -rn | head -n 5

44 You need to run a command long_running_script.sh. You want to append its standard output to out.log and its standard error to err.log, while simultaneously viewing both stdout and stderr on your terminal in real-time. Which command achieves this?

manipulate file output Hard
A. { ./long_running_script.sh 2>&1 1>&3 | tee -a err.log; } 3>&1 | tee -a out.log
B. ./long_running_script.sh 2>&1 | tee -a out.log err.log
C. ./long_running_script.sh &> >(tee -a out.log err.log)
D. ./long_running_script.sh > >(tee -a out.log) 2> >(tee -a err.log >&2)

45 You need to change the kernel's I/O scheduler for the block device /dev/sdb from mq-deadline to kyber for the current session only. You want to use the most direct and fundamental file-based interface provided by the kernel for this task. Which command should you use?

explore the linux kernel Hard
A. tuned-adm profile latency-performance
B. echo kyber > /sys/block/sdb/queue/scheduler
C. echo 'ACTION=="add", KERNEL=="sdb", ATTR{queue/scheduler}="kyber"' > /etc/udev/rules.d/10-scheduler.rules
D. sysctl -w dev.sdb.queue.scheduler=kyber

46 A newly compiled kernel module my_driver.ko fails to load using insmod ./my_driver.ko, reporting a "disagrees about version of symbol module_layout" or a similar "invalid format" error with vermagic mismatch in dmesg. What is the most likely cause and the correct way to fix it?

install and configure kernel modules Hard
A. The module was compiled against a different kernel version's headers than the currently running kernel. Recompile the module using the headers for the active kernel.
B. The kernel is tainted. You must first reboot the system to clear the tainted state before loading new modules.
C. The module file is corrupt. You need to run depmod -a to recalculate module dependencies and checksums.
D. The module has a dependency that is not loaded. Use modprobe ./my_driver.ko to resolve dependencies automatically.

47 A kernel module faulty_driver is known to cause instability. You need to prevent it from being loaded automatically by any mechanism (e.g., udev, manual modprobe), but you do not want to remove the module file itself. Which configuration in /etc/modprobe.d/blacklist.conf will be most effective and robust in achieving this?

monitor kernel modules Hard
A. options faulty_driver disable=1
B. install faulty_driver /bin/true
C. blacklist faulty_driver
D. deny faulty_driver

48 Your system fails to boot after a disk migration, dropping to a dracut emergency shell. The initramfs cannot find the root filesystem, which now has a new UUID. From the emergency shell, how can you temporarily fix the boot process to get the system running without rebooting into a rescue environment?

configure linux boot components Hard
A. Run dracut --regenerate-all --force from the emergency shell to automatically detect the new hardware and rebuild the initramfs in RAM.
B. Manually load the required disk controller module with insmod and then exit the shell.
C. Find the correct block device (e.g. /dev/sdb2), exit the shell, and at the dracut> prompt, type mount /dev/sdb2 /sysroot followed by exit.
D. Identify the new root device (e.g., /dev/sdb2), mount it, chroot into it, update /etc/fstab and GRUB, and regenerate the initramfs.

49 You need to permanently add the iommu=pt kernel parameter to all Linux boot entries and also ensure that any new kernels installed in the future will automatically inherit this parameter. Which sequence of actions is the correct, distribution-agnostic method?

configure GRUB2 Hard
A. Append GRUB_CMDLINE_LINUX="iommu=pt" to /etc/environment and run source /etc/environment.
B. Create a new file /etc/grub.d/09_custom_params containing echo 'set linux_cmdline_args="iommu=pt"' and make it executable.
C. Manually edit /boot/grub/grub.cfg and add iommu=pt to every line that starts with linux or linuxefi.
D. Edit the GRUB_CMDLINE_LINUX variable in /etc/default/grub to include iommu=pt and then run grub2-mkconfig -o /boot/grub2/grub.cfg or update-grub.

50 You are creating a daily incremental backup of /home/user to /mnt/backup/ using rsync. You want to use a directory from the previous day (e.g., /mnt/backup/2023-10-26) as a reference to minimize data transfer by creating hard links for unchanged files. Which rsync command correctly implements this efficient, space-saving strategy?

perform operations on files and directories Hard
A. rsync -aH --copy-dest=/mnt/backup/2023-10-26 /home/user/ /mnt/backup/2023-10-27/
B. rsync -aH --link-dest=/mnt/backup/2023-10-26 /home/user/ /mnt/backup/2023-10-27/
C. cp -al /home/user /mnt/backup/2023-10-27 && rsync -aH /home/user/ /mnt/backup/2023-10-27/
D. rsync -aH --compare-dest=/mnt/backup/2023-10-26 /home/user/ /mnt/backup/2023-10-27/

51 You need to find all symbolic links within /usr/local whose targets resolve to a path outside of the /usr/local directory tree. This includes links pointing to places like /opt/, /home/, or even dangling links. Which command will correctly identify and print only these specific links?

search for files Hard
A. find /usr/local -type l -exec readlink -f {} + | grep -v '^/usr/local'
B. find /usr/local -type l -exec bash -c 'target=1"); [[ 1"' _ {} \;
C. find /usr/local -xtype l
D. find /usr/local -type l -lname '/usr/local/*' -prune -o -print

52 You have a file data.txt with three columns: Category Item Value. You want to calculate the sum of Value for each Category and print only the categories whose total sum is greater than 1000. The final output should be formatted as Category,TotalValue. Which awk command correctly performs this analysis?

process text files Hard
A. sort data.txt | uniq | awk '{ sums[3 } END { for (cat in sums) if (sums[cat] > 1000) print cat "," sums[cat] }'
B. awk '{ sums[3 } END { for (cat in sums) if (sums[cat] > 1000) print cat "," sums[cat] }' data.txt
C. awk '{ if (1 "," $3 }' data.txt | sort | uniq
D. awk '{ sums[3 } { if (sums[1 "," sums[$1] }' data.txt

53 A system update has failed, and you can no longer boot into your graphical environment. You suspect the issue is with the init process. How can you edit the GRUB2 boot entry at startup to bypass the default systemd target and instead boot directly into a root shell for emergency repairs?

configure GRUB2 Hard
A. Append init=/bin/bash to the end of the linux or linuxefi line.
B. Replace quiet splash with systemd.unit=rescue.target on the linux line.
C. Append systemd.debug-shell=1 to the linux line.
D. Delete the initrd or initramfs line entirely.

54 You want the e1000e network driver to always load with the InterruptThrottleRate parameter set to 3000 for all cards using this driver. You also want to create an alias so that when a request for the generic eth-driver is made, e1000e is loaded. What should the content of a file in /etc/modprobe.d/ be?

install and configure kernel modules Hard
A. parameters e1000e InterruptThrottleRate=3000
alias eth-driver e1000e
B. softdep e1000e params InterruptThrottleRate=3000
alias eth-driver e1000e
C. install e1000e /sbin/modprobe e1000e InterruptThrottleRate=3000
alias e1000e eth-driver
D. options e1000e InterruptThrottleRate=3000
alias eth-driver e1000e

55 A script monitor.sh writes status to stdout and errors to stderr. You need to log stdout to status.log, stderr to errors.log, and also send a complete, interleaved copy of both stdout and stderr to combined.log. Which of the following command structures correctly achieves this complex logging setup?

manipulate file output Hard
A. ./monitor.sh > status.log 2> errors.log & tail -f status.log errors.log > combined.log
B. mkfifo p_all; tee -a combined.log < p_all & { ./monitor.sh 2>&1 1>&3 | tee -a errors.log; } 3>&1 | tee -a status.log > p_all
C. { ./monitor.sh 2> >(tee errors.log); } > >(tee status.log) |& tee -a combined.log
D. mkfifo p_out p_err; tee -a status.log combined.log < p_out & tee -a errors.log combined.log < p_err & ./monitor.sh > p_out 2> p_err

56 You are debugging a driver and need to view kernel log messages in real-time with the highest possible verbosity, including human-readable timestamps, log level prefixes, and kernel facility information. Which command provides this on a modern systemd-journald based system?

explore the linux kernel Hard
A. dmesg -w -T --level=debug
B. journalctl --dmesg --follow --output=verbose
C. cat /proc/kmsg
D. tail -f /var/log/kern.log

57 You run lsmod and see that module nfsd is listed with a "Used by" count greater than 0. You need to identify exactly which other loaded kernel modules are holding a reference to nfsd (i.e., its dependents). Which of the following is the most direct method to find this information?

monitor kernel modules Hard
A. grep nfsd /lib/modules/$(uname -r)/modules.dep
B. find /sys/module -name holders -exec grep -l nfsd {}/../.. \;
C. cat /proc/modules | grep nfsd
D. modinfo nfsd | grep depends

58 On a system using dracut to build its initramfs, you need to ensure that a proprietary, out-of-tree kernel module (my_driver.ko) and its firmware file (my_firmware.bin) are included in the initramfs so the system can boot from a device requiring this driver. What is the correct procedure?

configure linux boot components Hard
A. Create a configuration file like /etc/dracut.conf.d/my-driver.conf with the lines add_drivers+=" my_driver " and install_items+=" /path/to/my_firmware.bin ", then run dracut -f.
B. Copy my_driver.ko to /lib/modules/$(uname -r)/extra/ and my_firmware.bin to /lib/firmware/, then run depmod -a and dracut -f.
C. Add the line force_load="my_driver" to /etc/dracut.conf and reboot.
D. Place my_driver.ko in /etc/dracut.conf.d/ and my_firmware.bin in /etc/dracut.conf/, then run dracut -f.

59 You are editing a large file in vim. You want to find every line containing "WARNING" and prepend the current timestamp (e.g., "2023-10-27 10:30:00:") to the beginning of each of those lines. Which vim command sequence is the most direct way to accomplish this for all occurrences in the file?

create and edit text files Hard
A. :g/WARNING/s/^/\=strftime('%Y-%m-%d %H:%M:%S:') . ' '/
B. :g/WARNING/ normal! I<C-r>=strftime('%Y-%m-%d %H:%M:%S:')<CR><Esc>
C. :%s/(WARNING)/\=strftime('%Y-%m-%d %H:%M:%S:') . " \1"/g
D. qa:g/WARNING/<Enter>I<C-r>"=strftime('%Y-%m-%d %H:%M:%S:')<Enter><Esc>j@aq

60 You have two directories, dir_A and dir_B. You want to find all files that exist in dir_A but are missing from dir_B, based on filename only. Which of the following commands is the most efficient for this task, especially if the directories are large?

perform operations on files and directories Hard
A. for f in f" ] && echo $f; done
B. rsync -avun --delete dir_B/ dir_A/ | grep 'deleting'
C. diff -qr dir_A dir_B | grep "Only in dir_A"
D. comm -23 <(find dir_A -maxdepth 1 -type f -printf "%f\n" | sort) <(find dir_B -maxdepth 1 -type f -printf "%f\n" | sort)