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)