- df -h
- listid
- ls -l
- blkid
- discretionary access control system permissions layered over standard Linux permissions
- mandatory access control system permissions layered over standard Linux permissions
- a type of firewall for Linux
- the same as standard Linux permissions
- route -ipv6
- route
- ip -6 route show
- ip route show
find / -size +10M -exec ls -l {} ;
- It finds all files using ls -l and hands them off to the find command to display.
- It finds all files older than 10 minutes and long lists them using the ls command.
- It finds all files larger than 10 MB and long lists them using the ls command.
- It uses the ls command to find all files in the filesystem matching the {} wildcard.
locate --regexp '^/usr.*pixmaps.*jpg$'
- all files in a directory named pixmaps
- all files ending in ".jpg"
- all file paths that start with "/usr", include the word "pixmaps", and end with ".jpg"
- all file paths that include "/usr/pixmaps" and end with ".jpg"
- wireshark
- ethtool
- netstat
- tcpdump
- log
- uptime
- runtime
- access
- It is an application testing suite used to profile programming code.
- It is a local command used for monitoring local system resources in real time.
- It is a set of tools, services, and libraries for gathering and analyzing performance measures.
- It is a tool designed to change system configuration for purposes of optimization.
- Create a text file including all names and use the -f option of dig.
- Type in each query manually.
- Write a shell script to send multiple dig queries to the DNS server.
- Save the DNS names in an SQL database and process it with dig.
ps -e --format uid,pid,ppid,%cpu,cmd
- the user ID, process ID, parent process ID, CPU usage, and command name of a process
- the user ID, group ID, parent process ID, CPU usage, and command name of a process
- the UUID, process ID, parent process ID, CPU usage, and command name of a process
- all of these answers
- !
- !!
- !*
- !ls
- both private and public keys
- the ssh public key
- the ssh private key
- a fingerprint file
- find
- fdisk
- du
- df
Q14. A backup drive was created using dd to make a bit-for-bit copy. When the drive is inserted into an iSCSI target before it is booted up, the data appears to be missing. What happened?
- The backup drive is corrupted and needs to be re-created.
- When the backup drive was duplicates, the label was as well. When booted, the system mounted the old duplicates drive by its identical label.
- There is a conflict between the physical location of the backup drive and the original drive.
- The backup process went wrong, and the old drive was duplicates over the original drive.
- The tee command sends output only to STDOUT and STDERR.
- A redirect sends output to STDOUT and a file, whereas a tee sends output only to STDOUT.
- Nothing, they are the same.
- The tee command sends output to STDOUT and a file, whereas a redirect sends output only to a file.
- priority of one DNS server over another
- per network interface DNS server configuration
- alternative DNS services
- sources for name service information
Q17. Assume the variable myNumber holds a string consisting of 10 digits. What will this command output?
echo \$myNumber | sed -e 's/^[[:digit:]][[:digit:]][[:digit:]]/(&)/g'
- It will only match digits—and since the string has only digits, the command will output the same number without changes.
- It will output the same 10-digit number, but every digit will be inside parentheses.
- It will output the entire 10-digit number inside parentheses.
- It will output the same 10-digit number, but the first 3 digits will be inside parentheses.
Note: check the question below for a variant of this sed expression.
sed -E 's/[a-Z]{4}/(&)/' textfile.txt
- It would substitute the letter with an ampersand (&).
- It would replace all letters in the textfile.txt file with ampersand (&).
- It would replace the first four letters with an ampersand (&).
- It would place parentheses around the first four letters of each line of textfile.txt.
Note: check the question above for a variant of this sed expression.
Side note: this sed expression may fail with "sed: -e expression #1, char 15: Invalid range end" (for example on MINGW64 / Git Bash); if this is the case, you can try the alternative range [A-z]
.
- None of these answers. yum does not support downloading packages without installing them.
- --downloaddir
- -d
- --downloadonly
[0-9]
-
[[:alnum:]]
-
[[:digit:]]
-
[[:alpha:]]
-
[[:num:]]
Q21. When archiving files, which command will preserve all file attributes including ACLs and SELinux security context?
- zip
- tar
- archive
- gzip
Q22. In a systemd-based OS, you can change the system hostname by editing /etc/hostname manually and then doing what?
- Restart dhcpd.
- Run /etc/hostname.
- Nothing, the system notices automatically.
- Notify systemd to update it by restarting the systemd-hostnamed service.
Q23. What command would you use to resize an LVM volume group to include an additional physical volume?
- vgadd
- vgresize
- vgappend
- vgextend
0 1 \* \* \*
- every minute of the hour
- every hour of every day
- every day at 1:00 AM
- only on Mondays
Q25. ifconfig has been deprecated. What command is now recommended for changing IP addresses in the live config?
- netconf
- ipconfig
- ipman
- ip
Q26. You are managing an Apache web server on a system using SELinux. By default it cannot read personal webpages in users' home directories. What SELinux boolean would you set to allow this?
- apache_enable_homedirs
- httpd_enable_userdirs
- httpd_enable_homedirs
- httpd_enable_userhome_dirs
- The passwd command is not used for locking passwords.
- There is no password -l option.
- It locks only the password, not the account, so users can still authenticate with keys or other methods.
- It does lock the account, keeping users from logging in even if they are using other authentication methods.
- Piping into | pipes both stdout and stderr. Piping into |& pipes only stderr.
- Piping into | pipes stdout. Piping into |& pipes stdout and stderr.
- Piping into | pipes both stdout and stderr. Piping into |& pipes only stdout.
- Piping into | pipes stdout. Piping into |& pipes all open file descriptors.
- The kernel identifies it as one of the names of extended commands.
- It has the same name as the file it modifies.
- It has the SUID permission mode and is owned by root.
- It is a system administration command.
- always ask for confirmation
- back up the file before it deletes the file
- ask for confirmation if configured to do so
- never ask for confirmation
- Access to a drive is faster than with standard partitions.
- Volumes can be resized smaller without unmounting them.
- Repairing filesystem errors is easier than with standard partitions.
- Volumes can be resized even if the free space is not contiguous.
- Globs create a list; brace expansion matches pattern.
- Brace expansion requires files to exist; globs do not.
- Brace expansion creates a list; globs match the list of pathnames.
- Globs get processes first and brace expansion later.
- -d
- -k
- -b
- -x
- A
myVar = 5
[[ $myVar -lt 10 ]] && echo " Hello World"
- B
myVar = 5
[[ $myVar -lt 10 ]] || echo " Hello World"
- C
myVar = 5
[[ ! $myVar -gt 10 ]] && echo " Hello World"
- D
myVar = 5
[[ $myVar -gt 10 ]] || echo " Hello World"
- shell aliases
- userid
- environmental variables
- scheduling priority
- no_admin_squash
- no_root_squash
- allow_root_access
- all_squash
Q37. You send an email to a remote client using the following syntax. What will be in the body of the email?
date | mail -s "This is a remote test" user1@rhhost1.localnet.com
- "This is a remote test"
- the date, the time, and the words "This is a remote test"
- The email subject shows "This is a remote test" but the body of the email will be empty.
- the current date and time
- resolving the local name
- blocking sites using iptables
- setting the hostname
- configuring DNS name servers
Q39. In an extended regular expression, you would use (pattern){3} to match three instances of the pattern. How would you match the same thing with an extended glob?
- 3(pattern)
- {0,3}(pattern}
- Occurrence quantifiers are not supported in Bash's version of extended globs, so this is not possible.
- {3}(pattern})
- Samba uses Linux operating system groups from the /etc/group file; just specify the group name.
- It would be preceded by a percent sign (%), such as %engineers.
- Use the group name by itself; Samba checks for its existence.
- It would be preceded by an @ symbol, such as @engineering.
- krb5-workstation
- ktutil
- pam_krb5
- kdb5_util
Q42. To search from the current cursor position up to the beginning of the file using VIM, type _ and then the search criteria.
-
?
-
\
-
/
-
/search
- It is a graphical tool that manages network connections, including bonding and wireless networks.
- It is a security service that manages user access control of local network-aware services.
- It attempts to keep an active network connection available at all times.
- It is a command-line tool that manages network connections.
- to log out a user
- to lock a user's account
- to change global user account settings
- to set a user's password
- It prepares the filesystem for use by defragmenting it.
- It resizes the filesystem to match the volume group size.
- It does nothing.
- It remounts the filesystem with the new size.
- bonding.
- team.
- netbond.
- bond.
find / -size -10K -exec ls -l {} \;
- It finds all files larger than 10k and long lists them using the ls command.
- It finds all files of size 10k using ls -l and hands them off to the find command to display.
- It finds all files in the / directory of size 10k and long lists them.
- It finds all files in the file system smaller than 10k and long lists them using the ls command.
- /proc/swapiness
- /etc/fstab
- /etc/mounts
- /etc/swaps
- systemctl list-services.
- chkconfig --list-all
- systemctl list-unit-files -at service
- systemctl list-unit-files -t service
- gpasswd
- passwd
- editsam
- grouppass
- two dashes
- a backslash
- one dash
- nothing
Q52. What would happen if you have a script file named script that takes a long time to complete, and you type nohup ./script &
in the command line?
- The script will remain running in the background even if you reboot the system.
- The script will run in your terminal and you will not be able to do anything until it completes.
- The script will run in the background until you end the session.
- The script will run in the background and will continue running even if you end the session.
Reference: Wikipedia
nohup is a POSIX command which means "no hang up". Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out.
- enter the root user's password
- enter their own password
- enter the sudo user's password
- change to the root group
0 22 * * 1-5
- on the 22nd of every month from June to May
- at 10:00 PM Monday to Friday
- every 22 minutes every day except weekends
- from 1:00 AM to 5:00 AM on the 22nd of every month
- Firewalls are only service specific, whereas TCP Wrappers can block all traffic.
- TCP Wrappers works at the network layer, so it blocks traffic before the firewall even sees it.
- Firewalls easily spawn commands to operate on connection data, whereas TCP Wrappers cannot.
- TCP Wrappers works at the application layer, so it can make access decisions on encrypted data.
Note: TCP Wrapper works on Application Layer but answer is not too much confirmed.
Q56. As root, you set execute permissions for user, group, and other on a directory. Now users can do what?
- They can execute files in it.
- They can traverse it.
- They can read files in it.
- They can delete files in it.
Note: This is correct because of the keyword "directory". More info at: https://www.tutorialspoint.com/unix/unix-file-permission.htm
echo "Thu Jun 4 15:45:45 PDT 2020" | cut -f3 -d" "
- It will print nothing.
- Thu Jun 4 15:45:45 PDT 2020
- 0.6567708333333333
- 4
if ls /etc/passwd &> /dev/null
then
echo "exists"
fi
- The code snippet cannot be improved, this is a valid way of checking for the existence of a file.
- Use Bash's built-in
[[ ]]
test conditions instead of the ls command. - The redirect to
/dev/null
will silence the return code invalidating the conditional. Removing the redirect will solve this. - The ls command will output the name of the file to the screen. Running ls in quiet mode will improve the code snippet.
Q59. Using a systemd-based distribution, you want to restrict the cron service from running either automatically or manually. Which command would you run?
- systemctl disable crond
- systemctl disallow crond
- systemctl mask crond
- systemctl stop crond
Note: This is the correct answer because "mask" prohibits all kinds of activation of the unit, including manual activation. Reference : search "mask".
Q60. What issue might a user have when they mount a filesystem by partition path such as /dev/sdal in the /etc/fstab file?
- The device order may change on boot, resulting in a system that will not boot properly.
- The user may run out of device letters.
- There are no issues with referring to partitions by their partition path.
- It is more difficult identifying mounted devices by partition path.
- grep -E
- grep -B
- grep -e
- grep -G
Explanation: Man page of grep command.
- a facility and an action
- a filter and an action
- a facility and a priority
- a filter and a priority
- nmcli
- ip
- Onmtui
- nm-connection-editor
- It will clean up all previously generated binaries and perform a new build.
- It will run rules of compilation and building.
- It will look for a file called makefile in your current directory.
- It will build only programs that need to be rebuilt.
- -S
- --selinux
- --MAC
- -Z
- whoami and logname provide the same information.
- whoami tells who are you currently, and logname tells who you were when you logged in initially.
- logname specifies the name of the login log file, and whoami prints the logged in username.
- whoami shows you who logged in as initially, and logname shows who are you currently.
- declare -a
- aarray
- array -a
- declare -A
- lvcopy
- tar
- pvmove
- cp
Q69. What is the difference the ==
and =~
comparison operators when used in BASH double square bracket if
conditionals?
- The
==
operator performs a string comparison;=~
performs a regex comparison. - The
==
operator performs a string comparison;=~
performs a glob pattern comparison. - The
=~
operator performs a string comparison;==
performs a regex comparison. - There is no
=~
operator in BASHif
conditionals.
echo "data" | tee -a file.txt
echo "data" >> file.txt
- The first line will append the word
data
to file.txt and output it on the screen. The second line will append the worddata
only to file.txt. - They are the same.
- The first line will append the word
data
to file.txt and there will be no output on the screen. The second line will output the worddata
on the screen and append it tofile.txt
- Both lines will overwrite file.txt with the word data.
(ss).*\1
- addressee
- possess
- barrenness
- successfully
- compile the script with a CGI compiler
- make the script executable
- make the script executable and set the
httpd_enable_cgi
SELinux boolean - change the ownership of the script to Apache
Q73. To permanently add NAT to the default zone using firewalld, you would use which command string?
-
firewall-cmd --permanent --add-nat
-
firewall-cmd --permanent --add-masquerade
-
firewall-cmd --zone=default --add-nat
-
firewall-cmd --zone=default --add-masquerade
if [[ $FILE == $GLOB ]] ;then
- The single equal sign (
=
) is an assignment operator; the double equal sign (==
) checks equality. - There is no difference.
- The single equal sign (
=
) checks equality; the double equal sign (==
) checks string equality. - The double equal sign (
==
) is an assignment operator; the single equal sign (=
) checks equality.
Q75. journald
differs from traditional logging services such as rsyslogd
and syslogd
because its logs are _ by default.
- stored remotely
- text
- persistent
- not persistent
- It transports the mail from user's computer to the mail server.
- It accepts mail and adds it to the mail queue for further processing.
- It stores the mail in a mail queue waiting for the MUA to download it.
- It transports mail from one mail server to another.
- Generate RSA or DSA key pairs using ssh-keygen.
- Change the remote user's password.
- Create a local SSL certificate.
- Change the remote SSH configure to allow it.
Q78. When installing a downloaded package on the RedHat-based distribution manual using RPM, what may you have to do first?
- Compile the package source code.
- Download all dependencies and install them before installing the desired package.
- Agree to an end-user license agreement.
- provide the --resolve option so RPM resolves all packages dependency.
Explanation: Rpm is not meant to resolve dependencies. It checks whether required software (versions) are installed and fails when software is missing and when the wrong version of software is installed.
Q79. With GNU tools such as a GNU grep, awk, and sed, what is the difference between basic regular expressions (BREs) and extended regular expressions (EREs)?
- EREs can match the groups.
- EREs support occurrence operators.
- ERE's support alternation.
- only the syntax differs.
Q80. What is the difference between reading the list of disk partitions from /proc/partitions
and getting it using fdisk -l
?
-
/proc/partitions
represents the disk partition table more accurately thanfdisk -l
-
/proc/partitions
shows only mounted drives.fdisk -l
shows all drivers. - There is no difference between the two, and both lists contain the same data.
-
/proc/partitions
is the kernel's list of partitions held in ram.fdisk -l
reads the partition table from the drive itself.
cat < in.txt > out.txt
- the content of in.txt.
- the output from the command line.
- Nothing, because you cannot redirect from a file (in.txt) to another file (out.txt). You can redirect only from a command to a file.
- Nothing, The redirect will create a new empty file, but there will not be any output from the cat command to redirect.
Q82. Using alternation in a POSIX-extended regular expression, which numbers would this pattern match?
^(([0-9][0-9]?)|(2[0-9][0-9]))$
- 0-99 and 200-299
- 0-99
- 200-299
- 0-299
- Starts the crond service now.
- Allows user to start the crond service.
- Unmasks the crond service.
- Ensures that the crond service starts automatically on bootup.
- associative arrays.
- extended regular expressions.
- debug traps.
- object orientation.
- Nothing, extended globs are already integrated into the shell and turned on automatically.
- Make extended globs persistent by adding
shopt -s extglob
to a shell startup file. - Type
shopt -s extglob
into a shell one time to set the option on permanently. - Make extended globs persistent by adding
shopt +s extglob
to a shell startup file.
- They provide inheritance for user and group permissions.
- They work only on files.
- They provide inheritance for group ownership.
- They grant access to the directory on which they are set.
- unit
- service
- single
- process
- cp
- pvmove
- tar
- lvcopy
- The apt remove command is a link to apt autoremove, so there are no differences.
- Both uninstall software. The apt autoremove command also uninstalls the dependencies.
- Both uninstall software. The apt remove command also uninstalls the dependencies.
- The apt autoremove command is a system service that routinely removes unused software packages.
- rpm --update
- rpm -ivh --force
- rpm --reinstall
- rpm2cpio
-
$!
-
$$
-
$?
-
$*
- volume mirroring
- volume striping
- increasing LV size while mounted
- reducing LV size while mounted
- ACLs allow permissions to be set for more than one user or group on a file or directory.
- ACLs provide mandatory access control (MAC) functionality through SELinux for files and directories.
- ACLs allow a file to be owned by more than one user and group.
- ACLs provide additional flags such as append-only and immutable.
- 256 bytes
- 1084 bytes
- 255 bytes
- 1023 bytes
- mv
- rn
- rename
- ren
- /etc/passwd-
- /etc/passwd
- /etc/paaswd.
- We can not recover
- :q!
- :wq
- :sq
- :w
- DHCPs
- subnet masks
- ports
- broadcast addresses
- ls
- cd
- du
- df
- 1950
- 1965
- 1960
- 1970
- $2
- $1
- $0
- $9
Q102. VirtualBox provides _, which are installed on guests and allow the guest operating system to access shared folders on the host system, share the clipboard, and some other similar actions.
- projects
- guest configurations
- SSHs
- guest additions
Q103. Given an IP address of 199.83.131.0 and a subnet mask of 255.255.255.0, what is the broadcast address?
- 199.83.131.1
- 10 Downing Street
- 199.83.131.0
- 199.83.131.255
Q104. Which Linux command shows a list of processes associated with the current user and the current terminal?
- ps
- ls
- pidof
- ps -e
Q105. In a shell script, to create an infinite while loop, make the condition always return true by using the _ command for the while loop condition.
- return
- continue
- true
- always
Q106. In Linux, which option is used with the uname command to print the processor architecture name?
- -p
- -arch
- -ps
- -pname
- The MTA
- Pine
- Procmail
- The MUA
- brace expansion
- variable expansion
- filename expansion (globbing)
- word splitting
Q109. When pattern matching using a glob or regular expression, how many characters does a character set match?
- one
- any number of characters
- zero or one
- one or more
-
assemble
builds only arrays of drives that do not have RAID metadata on them. -
assemble
is used to build existing RAID arrays. -
assemble
is a synonym forcreate
. -
assemble
is used to build new RAID arrays.
Q111. When pattern matching using a glov or regular expression, how many characters does a character set match?
- zero or one
- one or more
- any number of characters
- one