Linux+ Flashcards
1. Which bash configuration files are used for non-login bash shell sessions? (Choose two.) A) /etc/profile B) /etc/bashrc C) ~/.bashrc D) ~/.profile E) ~/.bash_profile
- B and C are correct. Both /etc/bashrc and ~/.bashrc are used to configure non-login shell sessions, although other files may be used on some distributions.
A, D, and E are incorrect. The /etc/profile, ~/.profile, and ~/.bash_profile files are used to configure login shell sessions. (Topic 2. Systems Operation and Maintenance)
2. Choose the one’s that run at 4PM? (Choose two.) A) at 4PM B) at noon+4 C) at 16 D) at teatime E) at “4 o’clock”
- A and D are correct. Users can run at 4PM, at 16:00, or at teatime to schedule a job to run at 4PM.
B, C, and E are incorrect. Therse other forms of running at will return a syntax error message. (Topic 5. Automation and Scripting)
3. You’ve opened the /var/opt/myapp/settings.txt file in the vi editor. You need to enter new text into the file. Which key will switch a user into Insert mode from Normal or “Command” mode? A) i B) w C) z D) r E) x
- A is correct. Press the Insert or i key to enter Insert mode in the vi editor.
B, C, D, and E are incorrect. The ESC key is used to return to Normal (Command) mode from Insert mode in the vi editor. The a key is used to append text after the cursor. The o key opens a new line below before allowing for text to be inserted. The r key is used to replace a single character, and the x key is used by the vi editor to delete a single character. (Topic 2. Systems Operation and Maintenance)
4. YAML files used to configure network cards to use DHCP or setup Static IP addressing can be found where? A. /etc/X11 B. /etc/yum C. /etc/yum.repos.d D. /etc/netplan
- D is correct. Save a network configuration inside the /etc/netplan/config.yaml file to automate the configuration at boot time.
A, B, and C are incorrect. The /etc/X11 file is for the X-Window GUI setups, and the /etc/yum and /etc/yum.repos.d files point to software installation repositories. (Topic 1. Hardware and System Configuration)
5. To create a new directory in a user's home directory named MyFiles, use the following command to do this? A. mkdir ~/myfiles B. mkdir ~/MyFiles C. md ~/myFiles D. mkdir ~ MyFiles E. md ~/MyFiles
- B is correct. The mkdir command is used to create new directories in the file system where ì~ì stands for the userís home directory (in this case, /home/user/Myfiles or ~/MyFiles).
A is incorrect because it uses the wrong case for the directory name. C and E are incorrect because they use the incorrect command for creating new directories (md). D is incorrect because it omits the (/) character after the tilde. (Topic 2. Systems Operation and Maintenance)
6. The sealert utility is used to determine that a user cannot access a file. Which command would aid in troubleshooting by showing access settings? A. ls -s B. ls -Z C. ls -l D. restorecon E. aa-disable
- B is correct. Running ls -Z will allow the user to see the current SELinux settings and determine whether or not it need be changed.
A, C, D, and E are incorrect. Neither the ls -s and ls -l commands will list any file SELinux information, instead only showing file sizes, and a ìlong listingî, respectively. The restorecon command fixes and repairs SELinux labels. The aa-disable command is used to disable AppArmor, not SELinux. (Topic 3. Security)
7. Which vi command-line mode commands can be used to save changes to the current file being edited and close the vi editor? (Choose three.) A. ZZ B. :wq C. :q D. :q! E. :x
- A, B, and E are correct. The ZZ, :x and :wq commands will save any changes to the current file and then close the vi editor.
C, and D are incorrect. The :q command will close the current file and exit the editor without saving changes. The :q! command will discard any changes made to the current file, close it, and then exit the editor. (Topic 2. Systems Operation and Maintenance)
8. Change the permissions of a file named widgets.odt such that the file owner can edit the file, but no other users on the system will be allowed to view or modify it. Which command will do this? A. chmod 660 widgets.odt B. chmod 640 widgets.odt C. chmod 777 widgets.odt D. chmod 600 widgets.odt
- D is correct. The chmod 600 widgets.odt command grants the owner rw- permissions, but takes away permissions from all other users.
A is incorrect because it allows the file owner to edit the file, but also grants read and write access to the group. B is incorrect because it grants the group the read (r) permission. C is incorrect because it grants the owner, group, and others all permissions to the file. (Topic 3. Security)
9. Change the permissions of a file named projectx.odt such that the file owner can edit the file, users who are members of the group that owns the file can view and edit it, and users who are not owners and don't belong to the owning group cannot view or modify it. Which command will do this? A. chmod 660 projectx.odt B. chmod 640 projectx.odt C. chmod 777 projectx.odt D. chmod 644 projectx.odt
- A is correct. The chmod 660 projectx.odt command grants the owner rw- permissions, the group rw- permissions, and others — permissions.
B is incorrect because it fails to grant the group the write (w) permission. C is incorrect because it grants the owner, group, and others all permissions to the file. D is incorrect because it fails to grant the group the write (w) permission and it grants others read (r–) permission to the file. (Topic 3. Security)
10. Which usermod command options must be used to add user accounts as members of a secondary group? (Choose two.) A. -a B. -s C. -g D. -p E. -G
- A and E are correct. The usermod -aG command adds the users you specify as members of the specified group(s).
B, C, and D are incorrect. The -s option is used by the usermod command to define the login shell that the user will run. The -g option assigns the user is primary group. The -p option changes the password assigned to the user. (Topic 2. Systems Operation and Maintenance)
11. Which control structure processes over and over as long as a specified condition evaluates to false? A. while B. until C. for D. case
- B is correct. An until loop runs over and over as long as the condition is false. As soon as the condition is true, it stops.
A, C, and D are incorrect. A while loop executes over and over until a specified condition is no longer true. A for loop processes a specific number of times. A case statement is not a looping structure. (Topic 5. Automation and Scripting)
12. For designing the implementation of a new Linux server in the companyís network, the server will function as an internal file and print server for the organization. Employees will save their work-related files in shared storage locations on the server, and print jobs for shared printers will be managed by the server as well. What services should be included in the specifications? (Choose two.) A. Apache B. MySQL C. Samba D. Telnet E. Pure-FTP F. CUPS
- C and F are correct. The Samba service provides file sharing. CUPS is used to manage printing.
A, B, D, and E are incorrect. The Apache web server is frequently implemented on Linux in conjunction with the MySQL database server to develop web-based applications. Telnet is an older service that was formerly used for remote access. Pure-FTP provides an FTP service. (Topic 2. Systems Operation and Maintenance)
13. This process takes over and kills processes which use too much memory because they score too high under this process monitoring system? A. BOMB B. BOM C. KaBOOM D. BOOM E. OOM
- E is correct. The Out of Memory Killer watches for processes that use too much memory and selects them for killing when the system has a serious memory shortage.
A, B, C, and D are incorrect and are non-existent Linux tools, but the names sure sound cool :-). (Topic 4. Linux Troubleshooting and Diagnostics)
14. Which tools can be used to check for open network ports? (Choose two.) A. nmap B. lsof C. pwconv D. ssh E. cpio
- A and B are correct. Either nmap -sT -p 1-1024 10.0.0.* is used to scan for open ports between 1-1024, and lsof -i is also used to scan for open network ports.
C, D, and E are incorrect. The pwconv command is used to create the /etc/shadow file from the /etc/passwd file. The ssh command is used to make secure remote login connections. The cpio command is used to create tape backups.. . (Topic 4. Linux Troubleshooting and Diagnostics)
15. To insert a new kernel module into a Linux system that has no dependencies, which tool is best to use to utilize the module? A. dmesg B. modinfo C. insmod D. depmod E. lsmod
- C is correct. Use insmod to insert a module.
A, B, D, and E are incorrect. The lsmod command shows a list of currently installed modules. The dmesg program shows hardware found during bootup. The depmod command looks for module dependencies and updates the modules.dep file. And, the modinfo command provides the user info about a module. (Topic 1. Hardware and System Configuration)
16. Which of the following commands is used to find the domain's mail server? A. dig B. ping C. traceroute D. route
- A is correct. A systems administrator could run dig jordanteam.com MX and list the location of the mail server.
B, C, and D are incorrect. The ping command is used to test networks, and traceroute will list the routers used for a packet to reach its destination. The route command is used to define or display the default gateway. (Topic 2. Systems Operation and Maintenance)
17. Which command updates every few seconds displaying the routers that packets use to reach their destination? A. mtr B. traceroute C. tracert D. iftop E. top
- A is correct. Use the mtr command to visualize the routes a packet takes to reach its destination.
B, C, D, and E are incorrect. The traceroute command is similar to mtr, but is command line, and does not operate periodically. The tracert command is the same as traceroute but works on the Windows Operating System. The top command updates periodically, and shows process activity. The iftop command updates periodically displaying network traffic. (Topic 4. Linux Troubleshooting and Diagnostics)
18. When using local authentication on a Linux system, which file contains the passwords for the user accounts? A. /etc/passwd B. /etc/group C. /etc/gshadow D. /etc/shadow
- D is correct. The /etc/shadow file contains the encrypted passwords for user accounts.
A, B, and C are incorrect. The /etc/passwd file contains the user accounts and user IDs. The /etc/group file is used for local group definitions.. The /etc/gshadow file contains passwords for thegroups. (Topic 2. Systems Operation and Maintenance)
19. Consider the following entry from the /etc/passwd file: algreer:x:1001:100:Albert Greer:/home/algreer:/bin/bash. What user ID (UID) has been assigned to this user account? A. algreer B. 1001 C. 100 D. Albert Greer
- B is correct. The third field in each user entry in /etc/passwd specifies the userís ID number (UID). In this case, itís 1001.
A is incorrect because it specifies the username. C is incorrect because it specifies the group ID (GID) of the userís primary group. D is incorrect because it specifies the userís full name. (Topic 2. Systems Operation and Maintenance)
20. Consider the following entry from the /etc/shadow file: kmorgan:$2a$05$KL1DbTBqpSEMiL.2FoI3ue4bdyR.eL6GMKs7MU6.nZl5SCC7/REUS:15043:1:60:7:5::. In how many days will this account be disabled after the user's password has expired? A. One day B. Seven days C. Five days D. Null value (never)
- C is correct. The seventh field in each record in /etc/shadow specifies the number of days to wait after a password has expired to disable the account.
A is incorrect because it specifies the minimum number of days (one) required before a password can be changed.
B is incorrect because it specifies the number of days prior to password expiration before the user will be warned of the pending expiration.
D is incorrect because it is assigned to the eighth field, which specifies the number of days since January 1, 1970, after which the account will be disabled. (Topic 2. Systems Operation and Maintenance)
21. Which of the below contain files that populate new user's home directories created with useradd? A. /etc/login.defs B. /etc/default/useradd C. /etc/skel D. /etc/default/grub
- C is correct. The /etc/skel directory contains files (usually startup scripts, like .bashrc) that populate a new userís home directory when created with useradd.
A, B, and D are incorrect. The /etc/default/useradd file contains defaults used by the useradd utility, e.g. userid and default shell. The /etc/default/grub file contains booting defaults. The /etc/login.defs file defines the locations of new userís mail directories, etc. (Topic 2. Systems Operation and Maintenance)
- Create a new account for a user named Ian Mausi on a Linux system. Specify a username of imausi, a full name of Ian Mausi, a default shell of /bin/bash, and that a home directory be created. Which command will do this?
A. useradd -c “Ian Mausi” -m -s “/bin/bash” imausi
B. useradd -c “Ian Mausi” -m -s “/bin/bash” -u imausi
C. usermod -c “Ian Mausi” -m -s “/bin/bash” imausi
D. useradd -c “Ian Mausi” -s “/bin/bash” imausi
- A is correct. The useradd -c “Ian Mausi” -m -s “/bin/bash” imausi command creates a new user account for a user named Ian Mausi with a username of imausi, a full name of Ian Mausi, a default shell of /bin/bash, and a home directory.
B is incorrect because it uses incorrect syntax for the useradd command, where -u is followed by a userid number. C is incorrect because it uses an incorrect command (usermod). D is incorrect because it omits the -m option, which is required to create a home directory. (Topic 2. Systems Operation and Maintenance)
23. Which file keeps a list of intentionally untracked files that git should ignore? A. .gitnot B. gitnot C. .gitignore D. .git
- C is correct. The .gitignore file keeps a list of files that should be ignored by the git command.
A and B are incorrect because there are no such files as .gitnot or gitnot. D is incorrect because .git is a directory that contains the repository for the project.. (Topic 5. Automation and Scripting)
24. Command Substitution, which allows a command to run within a command is performed with which operators? (Choose 2) A. ` ` B. $( ) C. ë ë D. ì ì E. ${ }
- A and and B are correct. Users can use the backticks, e.g. echo Today is
date
, or dollar sign & parentheses, e.g. echo Today is $(date). The output of the date command will be the input to the echo command.
C, D, and E are incorrect. The single quotes make all characters literal. The “double quotes” make all characters literal except for the \, $, and ` (backtick), (with some exceptions to !, @, and * that are outside the scope of the exam). Dollar with curly braces, ${ }, are used to dereference a variable. (Topic 5. Automation and Scripting)
- An Administrator runs mount /dev/sdb2 /external, and realizes they have made a mistake because a filesystem was already mounted to /external. What happened to the files that were initially mounted onto /external?
A. The files are destroyed and can only be recovered from backup tape
B. Linux does not allow for a filesystem to be mounted onto another
C. The files are temporarily merged with the new filesystem
D. Nothing. When the administrator runs umount /dev/sdb2, the files will reappear unharmed
- D is correct. When the administrator runs umount /dev/sdb2, the files will reappear unharmed
A, B, and C are incorrect. (Topic 1. Hardware and System Configuration)
26. A script that will require the end user to enter the name of their supervisor will use which of the following lines to input the user's response into a variable named SUP? A. read SUP B. input SUP C. prompt SUP D. query SUP
- A is correct. The read command is used to pause the script and prompt the user to provide some type of input, which is assigned to the specified variable.
B, C, and D are incorrect. The input, prompt, and query commands cannot be used to read user input, and are distractors. (Topic 5. Automation and Scripting)
- When a new user attempts to run a script while in their home directory using the
./runme.sh command from the shell prompt, they see the following error: bash: ./runme.sh: Permission denied. Which resolution will fix this issue?
A. Copy the file to the ~/bin directory.
B. Add the home directory to the PATH environment variable.
C. Enter chmod u+x runme.sh at the shell prompt.
D. Change the sha-bang line of the script to #!/bin/sh
- C is correct. The error shown is caused by not having the execute permission set for the user trying to run the script. The chmod u+x runme.sh command will allow the user who owns the file to run it.
A and B are incorrect because they resolve path-related problems, which are not an issue in this scenario. D is incorrect because it changes the command interpreter to the /bin/sh (Bourne) shell, which is not necessary in this scenario. (Topic 5. Automation and Scripting)
- Which of the following will make for the fastest restore, and fewest number of tapes to restore, assuming the system fails shortly after the Friday backup completes?
Key: F=Full, I=Incremental, D=Differential?
A. Mon-F1, Tue-D1, Wed-I1, Thu-D2, Fri-F2
B. Mon-F1, Tue-D1, Wed-I1, Thu-D2, Fri-I2
C. Mon-F1, Tue-D1, Wed-D2, Thu-D3, Fri-D4
D. Mon-F1, Tue-I1, Wed-I2, Thu-I3, Fri-I4
- A is correct. If the system fails after the backup completes on Friday, the only tape required to fully restore would be F2 (Full backup, Number 2 made on Friday).
B, C, and D are incorrect. B would require 3 tapes to recover in this order, Full-1, Differential 2, and Incremental 2. C would require 2 tapes to recover in this order, Full 1, and Differential 4. Case D would require all tapes to recover in the order of F1, I1, I2, I3, and I4. (Topic 3. Security)
29. Which of the following commands can convert a SHELL variable to an ENVIRONMENT variable? A. env B. export C. set D. chmod
- B is correct. Running export VAR1 will convert VAR1 from a SHELL variable to an ENVIRONMENT variable.
A, C, and D are incorrect. The env command will display all of the ENVIRONMENT variables defined. The set command will display all of the SHELL variables defined. The chmod command can change read, write, and execute permissions on files. (Topic 5. Automation and Scripting)
30. Which command would an Administrator run to generate a sequence of numbers that starts at 1, increments by 1, and stops at 100? (Choose two.) A. for i in `seq 1 5 100` B. for i in `seq 100` C. for i in `seq 1 1 100` D. for i in `seq 1-100` E. for i in `seq 1..100`
- B and C are correct. When an Administrator specifies a single value with seq, the sequence starts at one, increments by one, and ends at the specified value. If three values are specified, the sequence starts at the first value, increments by the second value, and ends at the third value.
A is incorrect because it increments by five instead of one. D and E are incorrect because they use incorrect syntax for the seq command. (Topic 5. Automation and Scripting)
31. Which command can uncover a remote user's login name and password when they connect using telnet or ftp? A. dig B. nslookup C. tcpdump D. ip
- C is correct. The tcpdump command monitors network traffic and can display unencrypted login names and passwords.
A, B, and D are incorrect. The dig and nslookup commands list the IP addresses that domain names belong to. The ip command is used to define and setup network devices. (Topic 4. Linux Troubleshooting and Diagnostics)
32. Which protocols encrypt the network traffic? (Choose two.) A. SSH B. FTP C. TELNET D. HTTPS E. FINGER
- A and D are correct. SSH and HTTPS encrypt traffic traveling along the network.
B, C, and E are incorrect. FTP, TELNET, and FINGER communicate across the network using unencrypted data, and should be disabled for best security. (Topic 3. Security)
33. Which of the below is NOT a Single Sign-On system? A. RADIUS B. KERBEROS C. TACACS+ D. CIRCUMFERENCE E. LDAP
- D is correct. There is no single sign-on system referred to as CIRCUMFERENCE.
A, B, C, and E are incorrect. Each of these are single sign-on systems which allow a user to use a single digital identity across multiple domains. (Topic 3. Security)
34. Consider the following IP address: 172.17.8.10/22. Which subnet mask is assigned to this address? A. 255.255.252.0 B. 255.255.0.0 C. 255.255.255.0 D. 255.255.255.252
- A is correct. The /22 prefix length indicates the first two octets of the subnet mask (16 bits) are populated plus six additional bits in the third octet.
B, C, and D are incorrect. The prefix length for 255.255.0.0 would be /16. The prefix length for 255.255.255.0 would be /24. The prefix length for 255.255.255.252 would be /30. (Topic 4. Linux Troubleshooting and Diagnostics)
- Which command would assign the ens32 interface an IP address of 172.17.8.1 with a subnet mask of 255.255.0.0 and a broadcast address of 172.17.255.255?
A. ip addr set ens32 172.17.8.1/255.255.0.0 bcast 172.17.255.255
B. ip addr 172.17.8.1/255.255.0.0 broadcast 172.17.255.255 dev ens32
C. ip addr set 172.17.8.1/255.255.0.0 broadcast 172.17.255.255 dev ens32
D. ip addr add 172.17.8.1/255.255.0.0 broadcast 172.17.255.255 dev ens32
- D is correct. This command will assign the ens32 interface an IP address of 172.17.8.1 with a subnet mask of 255.255.0.0, and a broadcast address of 172.17.255.255.
A, B and C are incorrect because they use incorrect parameters for setting the subnet mask and broadcast address. (Topic 4. Linux Troubleshooting and Diagnostics)
36. Which directive in /etc/sysconfig/network/ifcfg-eth0 is used to specify whether the interface is automatically enabled when the system is booted? A. STARTMODE B. BOOTPROTO C. IPADDR D. USERCONTROL
- A is correct. STARTMODE determines whether the interface is started automatically at system boot or must be manually enabled.
B, C, and D are incorrect. The BOOTPROTO parameter can be set to a value of STATIC to use static IP address assignments or to DHCP to configure dynamic IP addressing. IPADDR assigns an IP address to the interface but only works if BOOTPROTO is set to STATIC. USERCONTROL determines whether standard user accounts are allowed to manage the interface. (Topic 4. Linux Troubleshooting and Diagnostics)
37. Which system keeps one NIC sleeping, and awakens when another NIC fails? A. Active-Passive B. Active-Active C. Load Balancing D. Aggregation
- A is correct. Active-Passive clusters reserves a passive NIC that becomes active when another NIC fails.
B, C, and D are incorrect because Active-Active clusters systems keep all NICs active and running and are designed primarily for Load Balancing and load Aggregation. C and is incorrect because it is used to configure the systemís hostname. (Topic 1. Hardware and System Configuration)
38. For security reasons, a Linux system should resolve hostnames using the DNS server before trying to resolve them using the /etc/hosts file. Which file is reconfigured to change the name resolver order? A. /etc/resolv.conf B. /etc/sysconfig/network/ifcfg-eth0 C. /etc/nsswitch.conf D. /etc/sysconfig/services
- C is correct. Use /etc/nsswitch.conf (name service switch) to define the order in which services will be used for name resolution.
A is incorrect because it is used to configure the IP address of the DNS server but does not configure the name service order. B is incorrect because it is used to configure IP addressing information but does not contain name resolution information. D is incorrect because it is used to configure how services will behave after they are updated. (Topic 1. Hardware and System Configuration)
39. The /etc/sudoers file on your Linux system is configured by default such that users must supply the root password when using sudo. Which BEST commands are used to modify the /etc/sudoers file? (Choose two.) A. gedit B. vi C. notepad D. sudoedit E. visudo
- D and E are correct. Use visudo or sudoedit /etc/sudoers to modify the /etc/sudoers file securely.
A, B, and C are incorrect. The gedit and vi commands could be used to edit /etc/sudoers as root, but is insecure as multiple users may be editing the file simultaneously, causing changes to be lost. The notepad command is an editor used with Microsoft Windows. (Topic 3. Security)
40. Which setting made in the proper file in the /etc/pam.d/ directory tracks login attempts and lockout users after multiple attempts? A. pam_access.so B. pam_loginuid.so C. pam_limits.so D. pam_tally2.so
- D is correct. Defining pam_tally2.so within proper files under /etc/pam.d/ can lock an account after 3 improper login attempts, for example.
A, B, and C are incorrect. Use pam_access.so for auditing and logging of access control. Use pam_loginuid.so to assist in login auditing as well. Use pam_limits.so to take advantage of ulimit features. (Topic 3. Security)