Study Guide - Assessment Test Flashcards
(91 cards)
3- The cat -n File.txt command is entered at the command line. What will be the result?
- The text file File.txt will be displayed.
- The text file File.txt will be displayed along with any special hidden characters in the file.
- The text file File.txt will be displayed along with any special symbols representing end‐of‐line characters.
- The text file File.txt will be displayed along with line numbers.
- The text file File.txt will be displayed in reverse order.
The text file File.txt will be displayed along with line numbers.
The cat -n File.txt command will display the File.txt text file along with line numbers. Therefore, option D is correct. The command in option A will simply display the File.txt file. Thus, option A is a wrong answer. To see any special hidden characters within the File.txt file, you would need to enter the command cat -A File.txt. Therefore, option B is an incorrect choice. End‐of‐line characters need a different cat command option, such as the -E switch. Therefore, option C is a wrong choice. The cat command does not have a switch that will allow a text file’s contents to be displayed in reverse order. Thus, option E is an incorrect choice.
4- Which of the following are stream editors? (Choose all that apply.)
- vim
- sed
- awk
- gawk
- nano
- sed
- awk
- gawk
The sed, awk, and gawk utilities are all stream editors. Therefore, options B, C, and D are correct. Both vim and nano are considered to be text editors. Therefore, options A and E are incorrect choices.
Stream Editors
A stream editor is a type of text processing utility that works by taking an input stream (such as a file or pipeline input), performing specified text transformations line by line, and then outputting the result to standard output.
Key characteristics of a stream editor in Linux include:
* Non-interactive processing: Unlike text editors like vim or nano, stream editors don’t provide an interactive interface. They apply edits automatically based on provided commands.
* Line-by-line operation: Stream editors process text sequentially, one line at a time, making them memory efficient even for large files.
* Filter behavior: They typically act as filters in a pipeline, receiving input, transforming it, and passing the result forward.
* Regular expression support: Most stream editors use regular expressions for pattern matching and text manipulation.
Script-friendly: They’re designed to be used in shell scripts and automation rather than manual editing.
sed
sed (Stream Editor) is a powerful command-line utility in Linux used for parsing and transforming text. It’s designed to perform basic text transformations on an input stream or file without requiring interactive editing
awk
awk is a powerful text processing tool in Linux, designed specifically for data extraction and reporting. It’s named after its creators: Aho, Weinberger, and Kernighan
Unlike sed which is primarily for substitutions and editing, awk excels at more complex data manipulation tasks where field-based processing is needed.
gawk
gawk (GNU awk) is the GNU Project’s implementation of the awk programming language in Linux. It’s a more feature-rich version of the standard awk utility
5- Which command in GRUB2 defines the location of the /boot folder to the first partition on the first hard drive on the system?
- set root=hd(0,1)
- set root=hd(1,0)
- set root=hd(1,1)
- set root=hd(0,0)
- set root=first
set root=hd(0,1)
GRUB2 identifies the hard drives starting at 0, but the partitions start at 1, so the first partition on the first hard drive would be 0,1 and option A is correct. Option B (1,0) defines the second hard drive and an incorrect partition number, so it is incorrect. Option C defines the first partition but the second hard drive, so it is incorrect. Option D defines the first hard drive but an incorrect partition, so it is incorrect. Option E uses the keyword first, which is not recognized by GRUB2, so it is incorrect.
6- If you see read or write errors appear in the system log, what tool should you use to correct any bad sections of the hard drive?
mount
unmount
fsck
dmesg
mkinitrd
fsck
The fsck program can perform a filesystem check and repair multiple types of filesystems on partitions, so option C is correct. The mount program is used to append a partition to a virtual directory; it can’t correct a partition that contains errors, so option A is incorrect. The unmount command removes a partition from the virtual directory, so option B is incorrect. Option D (the dmesg command) displays boot messages, and option E (the mkinitrd command) creates an initrd RAM disk, so both are incorrect.
fsck
fsck (File System Consistency Check)
Utility that checks and repairs Linux filesystem inconsistencies
Commonly used after improper shutdowns to ensure filesystem integrity
dmesg
dmesg (Display Message)
Displays kernel ring buffer messages, showing system startup and hardware detection information
Useful for troubleshooting hardware issues and viewing kernel boot messages
mkinitrd
mkinitrd (Make Initial RAM Disk)
Creates an initial RAM disk image used during the Linux boot process
Loads necessary modules and drivers before the main filesystem is mounted
7- The init program is started on a Linux system and has a process ID number. What typically is that process’s ID number?
- 0
- 1
- 2
- 10
- Unknown
1
The init program is typically started immediately after the Linux system has traversed the boot process, and it has a process ID (PID) number of 1. Therefore, option B is the correct answer. The Linux kernel has the 0 PID number, and thus, option A is a wrong answer. Options C, D, and E are also incorrect choices.
8- You need to determine the default target of a systemd system. Which of the following commands should you use?
- grep initdefault /etc/inittab
- runlevel
- systemctl is-enabled
- systemd get-target
- systemctl get-default
systemctl get-default
The systemctl get-default command will display a systemd system’s default target. Therefore, option E is the correct answer. The grep initdefault /etc/inittab command will extract the default runlevel for a SysV init system. Thus, option A is a wrong answer. The runlevel command will display a SysV init system’s previous and current runlevel. Therefore, option B is an incorrect answer. The systemctl is-enabled command shows whether or not a particular service, whose name is passed as a command argument, is configured to start at system boot. Thus, option C is a wrong choice. Option D is a made‐up command and therefore the wrong answer.
9- The Cinnamon desktop environment uses which window manager?
- Mutter
- Muffin
- Nemo
- Dolphin
- LightDM
Muffin
The Cinnamon desktop environment uses the Muffin window manager. Therefore, option B is the correct answer. Mutter is the window manager for the GNOME Shell desktop environment, though Muffin did fork from that project. Thus, option A is a wrong answer. Nemo is the file manager for Cinnamon, and therefore, option C is a wrong choice. Dolphin is the file manager for the KDE Plasma desktop environment. Thus, option D is a wrong choice. LightDM is the display manager for Cinnamon, and therefore, option E is also an incorrect choice.
Mutter
The Cinnamon desktop environment uses the Muffin window manager.
Muffin
Muffin
Nemo
Nemo is the file manager for Cinnamon desktop environment
Dolphin
Dolphin is the file manager for the KDE Plasma desktop environment.
LightDM
LightDM is the display manager for Cinnamon desktop environment
10- Your X11 session has become hung. What keystrokes do you use to restart the session?
- Ctrl+C
- Ctrl+Z
- Ctrl+Q
- Ctrl+Alt+Delete
- Ctrl+Alt+Backspace
Ctrl+Alt+Backspace
The Ctrl+Alt+Backspace will kill your X11 session and then restart it, putting you at the login screen (display manager.) Therefore, option E is the correct answer. The Ctrl+C combination sends an interrupt signal but does not restart an X11 session. Thus, option A is a wrong answer. The Ctrl+Z keystroke combination sends a stop signal, but it will not restart the X11 session. Therefore, option B is also an incorrect answer. The Ctrl+Q combination will release a terminal that has been paused by Ctrl+S. However, it does not restart an X11 session, so it too is a wrong choice. The Ctrl+Alt+Delete keystroke combination can be set to do a number of tasks, depending on your desktop environment. In some cases, it brings up a shutdown, logout, or reboot menu. However, it does not restart the X11 session, so option D is an incorrect choice.
11- What folder contains the time zone template files in Linux?
/etc/timezone
/etc/localtime
/usr/share/zoneinfo
/usr/share/timezone
/usr/share/localtime
/usr/share/zoneinfo
Both Debian‐based and Red Hat–based Linux distributions store the time zone template files in the /usr/share/zoneinfo folder, so option C is correct. The /etc/timezone and /etc/localtime files contain the current time zone file for Debian‐ and Red Hat–based systems, not the time zone template files, so options A and B are incorrect. The /usr/share/timezone and /usr/share/localtime folders don’t exist in either Debian‐based or Red Hat–based Linux distributions, so options D and E are also incorrect.
12- What systemd command allows you to view and change the time, date, and time zone?
- timedatectl
- localectl
- date
- time
- locale
timedatectl
The timedatectl program is part of the systemd package and allows you to both view and change the current time, date, and time zone for the Linux system, so option A is correct. The localectl program is also part of the systemd package, but it handles localization information and not time and date information, so option B is incorrect. The date command allows you to view and change the time and date but not the time zone setting, so option C is incorrect. The time command displays the elapsed CPU time used by an application, not the current time, date, and time zone, so option D is incorrect. The locale command allows you to view the localization settings for the Linux system, not the time, date, or time zone, so option E is also incorrect.
13- Which of the following files contain user account creation directives used by the useradd command? (Choose all that apply.)
- The /etc/default/useradd file
- The /etc/useradd file
- The /etc/adduser.conf file
- The /etc/login.defs file
- The /etc/login.def file
- The /etc/default/useradd file
- The /etc/login.defs file
The /etc/default/useradd file and /etc/login.defs file are files that contain user account creation directives used by the useradd command. Therefore, options A and D are the correct answers. Option B’s /etc/useradd file is a made‐up file name, and thus option B is a wrong choice. The /etc/adduser.conf file is only on Linux distributions that use the adduser utility to create accounts. Thus, option C is an incorrect answer. The /etc/login.def file is a made‐up file name, and thus option E is also an incorrect choice.
14- You need to display the various quotas on all your filesystems employing quota limits. Which of the following commands should you use?
edquota -t
quotaon -a
quotacheck -cu
quotacheck -cg
repquota -a
repquota -a
The repquota -a command will display the various quotas on all your filesystems employing quota limits. Therefore, option E is the correct answer. The edquota -t command will edit quota grace periods for the system. Therefore, option A is a wrong answer. The quotaon -a command will automatically turn on quotas for all mounted non‐NFS filesystems in the /etc/fstab file, but it does not display filesystems’ quotas. Thus, option B is an incorrect choice. The quotacheck utility creates either the aquota.group file, if the -cg options are used, or the aquota.user file, if the -cu switches are used, or both files if -cug is employed. However, it does nothing for displaying filesystems’ quotas. Thus, options C and D are incorrect answers.