General CompTIA Linux+ Questions (Extended) Flashcards

This is an extension of the other set of flashcards for the CompTIA Linux+ exam. (99 cards)

1
Q

What is lvmdiskscan intended to do and what is its modern equivalent? (Online)

A

The lvmdiskscan command scans for and displays disks which can be used for LVM physical volumes. The “pvs” is the modern equivalent and shows the same data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are three commands to display logical volumes on a system? (Pg. 227 and Online)

A

LVM Commands:
lvs – This shows all logical volumes and is a highly customizable command.
lvdisplay – This displays logical properties like size and mapping.
lvscan – This scans the system and lists the logical volumes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the killall command do? (Online)

A

killall <process_name> -- This kills all of the processes for a user which matches the input stated.</process_name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you automatically fix filesystem errors with the fsck command? (Online)

A

Example: fsck -y /dev/sdb – This checks /dev/sdb for filesystem errors and automatically fixes them. (“-y” = says “yes” to all fixes)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you do a test run with the fsck command? (Online)

A

Example: fsck -N /dev/sdb – This does a test run on the specified /dev/sdb disk without performing any actions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you display errors without performing any actions with the fsck command? (Online)

A

Example: fsck -n /dev/sdb – This displays any corruption errors with the /dev/sdb disk but does perform any action on it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you perform a filesystem check on all filesystems with the fsck command? (Online)

A

fsck -AR – This performs a filesystem check on all (“-A”) filesystems, except root (“-R”) as the root filesystem (“/”) cannot be unmounted on a running system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the default options specified by the /etc/fstab option “defaults?” (Online)

A

Default Options:
- rw – Allow reading and writing.
- suid – Enable security bits.
- dev – Enable files (under /dev) that represent access points to devices.
- exec – Enables binaries and files to be able to be executed on that partition.
- auto – Automatically mounts partition at boot.
- nouser – Only root can mount the partition.
- async – Allows asynchronous I/O; multiple threads instead of single-threading.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you enable user and group quotas on a partition? (Online)

A

The options “usrquota” and “grpquota” can be input in the options field of /etc/fstab to enable user and group quotas, respectively, on the disk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the vmstat command mean? (Pg. 612 and Online)

A

“vmstat” = “Virtual Memory STATistics”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What display all active and inactive memory running with the vmstat command? (Online)

A

vmstat -a – This displays totals of all (“-a”) active and instance memory of the system running.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you display all memory event counters with the vmstat command? (Online)

A

vmstat -s – This displays a summary of all event counters and memory statistics like the number of forks and pages paged in and out.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you display all RAM disk statistics with the vmstat command? (Online)

A

vmstat -d – This displays all RAM disk (“-d”) statistics such as numbers of reads and writes per disk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do print the available commands in fdisk and in gdisk, respectively? (Pgs. 190, 194)

A

m for fdisk and ? for gdisk – The “m” or “?” in fdisk and gdisk, respectively, prints the help menu, displaying available commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can you display the partition table in fdisk/gdisk? (Pgs. 190, 194)

A

p – This displays the partition (“p”) table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which commands do you need to create a new partition and have the changes take effect in fdisk/gdisk? (Pgs. 190-192, 194)

A

n then w – The “n” specifies a new partition to be made. Then after going through the options, the “w” will write the partition to the disk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How do you display the available partition types in fdisk/gdisk? (Pgs. 190, 194)

A

l – This lists (“l”) out the available filesystem types for fdisk/gdisk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How do you back up GPT data to a file with the gdisk utility? (Pg. 194)

A

b – This backs up GUID Partition Table data to a file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How can you rename a partition in the gdisk utility? (Pg. 194)

A

c – This changes (“c”) the name of the specified partition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How do you test if a regular file exists with the if bash statement? (Online)

A

Example: if [ -f file1 ] – This tests whether the regular file “file1” exists.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How do you test if any file or directory exists with the if bash statement? (Online)

A

Example: if [ -e /dev/sdb2 ] – This tests whether the file “/dev/sdb2” exists. The “-e” option can be used to test existence for any file type or directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do you test if a file is readable with the if bash statement? (Online)

A

Example: if [ -r file1 ] – This tests whether the file “file1” is readable by the current user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the xfs_growfs command used to do? (Online and Online)

A

Example: xfs_growfs -D <size> <mount_point> -- This grows a specified XFS filesystem to the specified size. (xfs_growfs “-d” <mount_point> will specify maximum size for the disk.)</mount_point></mount_point></size>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the functional equivalent xfs_growfs command of xfs_info? (Online)

A

xfs_growfs -n – This prints geometry information like inodes and block size like the xfs_info command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
How do you copy the metadata for a XFS filesystem to a file? (Online)
xfs_metadump -g -- This command dumps the metadata for the filesystem to a specified file. (The “-g” option shows a progress bar for the command.)
26
What is the facility which handles logs which come from the Linux kernel? (Pg. 547 and Online)
kern -- This is a rsyslog facility specified in /etc/rsyslog.conf for handling logs related to the Linux kernel.
27
What are two ways to print all of the elements in an array in one line? (Online)
echo “${array[&]}” OR echo “${array[*]}”
28
What does the && operator mean when combined between two commands? (Pg. 403)
Example: ls -d ./dir1 && ls -d ./dir2 -- In the example, the && operator makes it so that the second ls command executes only if the first ls command is *successful*.
29
What does the || operator mean when combined between two commands? (Pg. 403)
Example: ls -d ./dir1 || ls -d ./dir2 -- In the example, the || operator makes it so that the second ls command executes only if the first ls command was *unsuccessful*.
30
How many SCSI devices are supported per bus in Linux? (Pg. 385 and Online)
Excluding the host controller, 7 (for 8-bit Narrow SCSI) or 15 (for 16-bit Wide SCSI)
31
What is the default “Type” for a systemd service unit? (Online)
simple -- This means the process(es) started under the “ExecStart” field of the unit file is the main process(es) of the service.
32
What does the last command do and what file does it access? (Pg. 555)
The last command displays the last several logins to a system, as reported in /var/log/wtmp.
33
What does the faillog command do and what file does it access? (Pg. 555)
The faillog command displays the most recent failed login attempts, as reported in /var/log/faillog.
34
What does the lastb command do and what file does it access? (Pg. 555 and Online)
The lastb command displays every bad login attempt (not just failed attempts), as reported in /var/log/btmp.
35
What does the lastlog command do and what file does it access? (Pg. 556)
The lastlog command displays the last time that every user logged into the system, as reported in /var/log/lastlog.
36
How can you change the group of a file with one command? (Pg. 161)
Example: chgrp staff /tmp/myfile.txt -- This changes the group of the file “/tmp/myfile.txt” to the group “staff.”
37
What is an example of using the getent command? (Study Guide – Chapter 22 and Online)
Example: getent passwd BSisko -- This gets the entries for the specified user “BSisko” based upon the /etc/passwd file. (The “passwd” option could also be used to display entries for other files like “shadow” or “hosts.”)
38
How do you display a listing of recent commits in Git? (Pg. 580 and Online)
git log -- This gives a list of the latest commits to a repository, including a commit number and commit description.
39
How do you display the current branch, commits, and file changes in a Git repository? (Online)
git status -- This displays the current status of the Git repository, including current branch, commits, and file changes.
40
What does the iostat -yNz 5 2 command mean? (Study Guide – Chapter 20)
iostat -yNz 5 2 -- This displays 5 entries every 2 seconds for I/O statistics. The “-y” excludes statistics since system boot. The “-N” displays registered device mapper names for LVMs. The “-z” excludes devices with no activity.
41
How do you specify an I/O device for the iostat command? (Study Guide – Chapter 20)
iostat -p -- This displays I/O statistics for the specified disk device.
42
How do you do a filesystem check on a BTRFS disk? (Study Guide – Chapter 20)
btrfs check -- This command checks and repairs blocks on an unmounted BTRFS disk device.
43
How do you check for bad blocks on an XFS disk? (Study Guide – Chapter 20)
xfs_check OR xfs_repair -- Both commands check an XFS disk for bad blocks, but xfs_repair checks and then fixes the drive.
44
What does the iperf command do? (Pgs. 622-623 and Study Guide – Chapter 20)
The iperf command tests the throughput between a client and server.
45
How do you set up an iperf test from the server-side with a specified port? (Pg. 623 and Study Guide – Chapter 20)
Example: iperf -s -t 120 -- This sets up an iperf test to make the current host act as a server (-s), listening on TCP (“-t”) port 120.
46
How do you set up an iperf test from the client-side? (Pg. 624 and Study Guide – Chapter 20)
Example: iperf -c 192.168.0.104 -b 90Kb -d -P 5 -e -i 10 -- This executes an iperf test where the current host is the client (“-c”), sending packets to 192.168.0104 with a bandwidth (“-b”) of 90Kb, bidirectional (“-d”) testing, five parallel (“-P”) threads, enhanced (“-e”) output, and a periodic report iterating (“-i”) every 10 seconds.
47
If a user can login via one terminal and not by another, what should be checked regarding the latter terminal? (Study Guide – Chapter 22)
It should be checked whether the terminal’s /dev file is corrupt. For example, if ls -l /dev/tty4 results with the permissions listing the file as “-” (regular file) instead of “c” (character file), then the device would be corrupt.
48
With what command can you place hardware and software limits on a user? (Pg. 538, Percipio Course, and Online)
ulimit -- This puts limits on a user like the number of processes they can run or the maximum amount of memory that can be handled.
49
How do you restrict the maximum size of file a user can have? (Pg. 538 and Online)
Example: ulimit -f 100 -- This restricts the maximum file (“-f”) size for the current user to 100KB.
50
What do the fields “VIRT,” “RES,” “SHR,” and “S” in top mean? (Online)
Top Metrics: - VIRT = The amount of virtual memory in use. - RES = The amount of physical memory in use. - SHR = The amount of shared memory in use. - S = Process state – “s” = Sleeping OR “r” = Running.
51
How do you change the rate of delay in top? (Percipio Course)
Press “d” and then enter a number for the delay in seconds.
52
What does the mpstat command show? (Percipio Course and Online)
The mpstat command shows processor statistics, including many of the percentages described by the top utility.
53
How do you list a description of a specified package in YUM or DNF? (Online Lab, Online, and Online)
Example: yum/dnf info ssh -- This provides a detailed description of available and installed packages by the name “ssh.”
54
How do you display what package was the source of a specified file in YUM or DNF? (Pgs. 301, 303 and Online)
yum/dnf -- This displays what package installed the specified file.
55
How do you display the dependencies for a package in YUM or DNF? (Pgs. 301, 303 and Online)
yum/dnf deplist -- This displays the dependencies for a specified package.
56
How do you display the repositories in YUM or DNF? (Pg. 301 and Online)
yum/dnf repolist -- This displays the enabled YUM/DNF repositories for the local system.
57
What is the default package manager for Arch Linux? (Percipio Course)
pacman
58
How do you install a package with pacman manager? (Online)
Example: pacman -S docker.io -- This synchronizes (“-S”) to the main repository and installs the specified package “docker.io.”
59
How do you update packages with the pacman manager? (Online)
pacman -Syu -- This synchronizes (“-S”) to the main repository and then refreshes the local cache (“-y”), and updates (“-u”) the packages in the repository.
60
How do you look for an available package by a specified name with the pacman manager? (Online and Online)
Example: pacman -Ss docker -- This synchronizes (“-S”) to the main repository and searches (“-s”) for packages with “docker.”
61
How do you look for an installed package by a specified name with the pacman manager? (Online and Online)
Example: pacman -Qs docker -- This queries (“-Q”) the local repository and searches (“-s”) for packages with “docker.”
62
How do you delete a package and its dependencies with the pacman manager? (Online and Online)
Example: pacman -Rs docker.io -- This removes (“-R”) the specified package “docker.io” and recursively (“-s”) its dependencies as well.
63
What is the main package manager for SUSE Linux? (Pg. 304)
ZYpp
64
How do you install a package and uninstall a package simultaneously with ZYpp? (Pg. 304)
zypper install nano -vim -- This installs the package “nano” while it uninstalls the “vim” package, as denoted by the minus sign (“-”). (This command could be flipped with “remove” and plus sign (“+”).
65
How do you properly update packages with ZYpp? (Pg. 305-306)
zypper then zypper update -- This downloads RPM package metadata and applies updates to the packages.
65
How do you retrieve a listing of repositories with ZYpp? (Pg. 305)
zypper repos OR zypper lr -- This lists the RPM repositories that have been installed.
66
How do you add a repository with ZYpp? (Pg. 306)
zypper -- This adds the repository at the specified URL into the local ZYpp ecosystem.
67
How do you display repository configuration information with ZYpp? (Pg. 306)
zypper repos -d -- This displays repository configuration information for ZYpp.
68
How do you display information about a package with the apt-cache command? (Pg. 308)
apt-cache showpkg OR apt-cache show -- This displays information about the specified package.
69
How do you display the total number of APT packages installed on a system and other metadata? (Pg. 308)
apt-cache stats -- This displays the total number of APT packages installed on a system, among other cache statistics.
70
How do you display all of the package’s dependencies with the apt-cache command? (Pg. 308)
apt-cache depends -- This displays the specified package’s dependencies.
71
How do you list any missing APT package dependencies with the apt-cache command? (Pg. 308)
apt-cache unmet -- This displays any unmet, missing dependencies that are needed in the package cache.
72
What is the difference between apt upgrade and apt full-upgrade? (Online)
Both apt upgrade and apt full-upgrade will apply updates to packages. However, apt full-upgrade will delete an offending package if another package requires it to be removed during an update.
73
How do you download a package without installing it with the apt command? (Pg. 310)
apt -d install -- This downloads (“-d”) a specified package without installing it on the system.
74
How do you check to find (and fix) unmet dependencies while installing a package with the apt command? (Pg. 310)
apt -f install -- This installs the specified package and checks and attempts to fix unmet dependencies.
75
What are the main configuration files and directories for YUM and DNF? (Pgs. 298-299, 304)
/etc/yum.conf (main config file for YUM), /etc/dnf/dnf.conf (main config file for DNF), /etc/yum.repos.d/ (repository configuration directory for YUM and DNF)
76
What are the main configuration file and directory for ZYpp? (Pg. 304)
/etc/zypp/zypp.conf (main config file for ZYpp), /etc/zypp/repos.d/ (repository configuration directory for ZYpp)
77
What is main configuration file for the pacman manager? (Online)
/etc/pacman.conf
78
What are the main configuration files for DPKG? (Pg. 307)
/etc/dpkg/dpkg.cfg (main options for dpkg), /var/lib/dpkg/status (status of available packages)
79
What are the main configuration file and repository definition file for APT? (Pg. 308, Online, and Online)
/etc/apt/apt.conf (defines config file), /etc/apt/sources.list (defines apt repositories)
80
Once source code has been downloaded and extracted, what are three steps to compile a package from source? (Pgs. 315-316)
Commands: - configure -- This verifies that a compiler is present and creates Makefile. - make -- This produces the package binaries based upon the Makefile. - make install -- This installs a package onto the system, allocating files into the right places.
81
What are the three main filesystem procedures that the “make install” command performs? (Pg. 316)
1) Puts executable program into /usr/bin/. 2) Puts program libraries into /usr/lib/. 3) Puts program man pages in /usr/man/.
82
How do you uninstall a package and delete its configuration files with the dpkg command? (Pg. 307)
dpkg -P -- This uninstalls and purges (“-P”) a specified package, including deleting its configuration files.
83
How do you display information about an installed package with the dpkg command? (Pg. 307)
dpkg -p -- This displays information about a package that has been installed on the system.
84
How do you display information about a package which has not been installed with the dpkg command? (Pg. 307)
dpkg -I -- This displays information about a package that has not been installed on the system. ("-I" = Uppercase I)
85
How do you check the signature of a package with the RPM command? (Pg. 293)
rpm <-K/- -checksig> -- This checks the signature of a package to confirm whether it’s corrupted.
86
How do you display information about a package with the RPM command? (Pg. 296)
rpm -qi -- This queries for information of a specified package.
87
How can you display the source package for a file with the RPM command? (Pg. 296)
rpm <-qf/-q - -whatprovides> -- This queries and displays what package provided a specified file (“-f”).
88
How do you list dependencies for a package and packages that are dependent upon the package with the RPM command? (Pg. 296)
RPM Commands: - rpm <-qR/-q --requires> -- This queries for the package’s dependencies. - rpm --whatrequires -- This queries for the packages that are dependent upon the specified package.
89
What are two ways to displays the files that are in an RPM package? (Pgs. 296-297)
rpm -ql OR rpm2cpio | cpio -t -- This queries and lists (“-l”) the contents of a package or pipes the contents of the package to cpio and lists (“-t”) the contents.
90
How do you extract the contents of an RPM package with rpm2cpio? (Pgs. 296-297)
rpm2cpio | cpio -idv -- This extracts the contents of the file through cpio. (“-i" = Extract. “-d” = Create subdirectories. “-v” = Verbose output.)
91
What is the difference between a dynamic shared library and a static shared library? (Pgs. 318-319)
A dynamic shared library is one that is used by applications but is not compiled in an application directly, whereas a static shared library is actually compiled into an application.
92
What are the configuration file and cache directory for shared libraries in Linux? (Pgs. 319-320)
/etc/ld.so.conf (configuration file for shared libraries) and /etc/ld.so.cache (cache for shared libraries)
93
What are the two ways to add a shared library for use in the system? (Pgs. 320-321)
The first way is to add the library directory to /etc/ld.so.conf and use the ldconfig command which rebuilds the shared library cache. The second way is to add the library path to the LD_LIBRARY_PATH environment variable.
94
How do you display the available shared libraries on a Linux system? (Pg. 320)
ldconfig -p -- This displays the available shared libraries on a Linux system.
95
How do you see what shared libraries an executable is dependent on? (Pg. 320)
Example: ldd -v /sbin/ip -- This displays the shared libraries that the specified executable “/sbin/ip” is dependent on.
96
What are Snap, Flatpak, and AppImage? (Pgs. 310-311)
AppImage, Flatpak, and Snap are universal package managers used to install applications on Linux.
97
What is the common name of the package for Apache 2? (Pg. 302)
httpd
98
What is the common name for the DNS nameserver dnsd? (Pg. 302)
bind