0% found this document useful (0 votes)
2K views32 pages

Linux Essentials Chapter 8 18 Answers

The document contains questions and answers about Linux user accounts and groups. It covers commands for managing users (useradd, usermod, userdel), groups (groupadd, groupmod), and passwords (passwd). The files for storing user and group information are /etc/passwd for usernames and UIDs, /etc/shadow for encrypted passwords, and /etc/group for group names and GIDs. UIDs below 500 are typically reserved for system accounts. A user can belong to multiple groups, and groups are used to manage file permissions and roles.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views32 pages

Linux Essentials Chapter 8 18 Answers

The document contains questions and answers about Linux user accounts and groups. It covers commands for managing users (useradd, usermod, userdel), groups (groupadd, groupmod), and passwords (passwd). The files for storing user and group information are /etc/passwd for usernames and UIDs, /etc/shadow for encrypted passwords, and /etc/group for group names and GIDs. UIDs below 500 are typically reserved for system accounts. A user can belong to multiple groups, and groups are used to manage file permissions and roles.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

NDG Linux Essentials 2.

0 Chapter 15 Exam Answers


1. Which files contain user account information?
(choose two)
• /etc/shadow
• /etc/group
• /etc/passwords
• /etc/passwd
2. Which user can view the /etc/shadow file?
• Any member of the password group
• No users
• The root user
• All users
3. Which command will display the UID, GID and groups your
current user belongs to?
• whoami
• Who
• id
• about
4. Each user belongs to at least one group.
True or False?
• True
• False
5. Which command will display the users that are currently logged in
to the system?
• about
• who
• id
• whoami
6. The sudo command allows regular users to…
• …execute commands as another user.
• …execute any command as root, after providing the root password.
• …run any command as root, after providing the sudo password.
• …run any commands as a system account without logging in.
7. Which of the following commands will display the group(s) a user
belongs to?
• all
• id
• whoami
• group
8. Which of the following commands will display the groups that the
user bob belongs to?
• group bob
• id bob
• groups -a
• all bob
9. The /etc/group file follows what structure?
• group:GID:user_list
• groups -a
• user:group
• group_name:password_placehoder:GID:user_list
10. A GID is associated with a group name.
True or False?
• True
• False
11. A user can belong to…
• At least 16 groups
• Only five groups
• Only groups with a GID over 500
• Only one group
12. Sudo privileges can be used to specify which user can use
the sudo command to execute commands as other users.
True or False?
• True
• False
13. In distributions that do not allow the root user to login
directly or via the su command, the installation process
automatically configures one user account to be able to use
the sudo command to execute commands as if they were executed
by the root user.
True or False?
• True
• False
14. Which of the following commands will display how long the
system has been running since the last boot?
(choose two)
• who
• id
• uptime
• w
15. The /etc/shadow file contains plain-text passwords.
True or False?
• True
• False
16. Which command can be used to view the /etc/passwd file
entries?
• uptime
• uppasswd
• getpasswd
• getent
17. All Linux systems allow administrators to log in as root.
True or False?
• True
• False
18. What is the default user for the su command?
• All users
• The root user
• Any member of the password group
• The most recently created user
19. Which command would allow a user to execute commands
as root?
• whoami
• about
• sudo
• who
• grep
20. File permissions cannot be edited by the root user.
True or False?
• True
• False
21. Which command is used to display only the user’s primary
group?
• who
• id -g
• man
• whoami
• about
22. Traditional UNIX systems allowed users to belong to how
many groups?
• 10,000
• 1
• 65,000
• 256
• 16
23. What would an account with the UID 376 typically be used
for?
• White hat hackers.
• Temporary employees.
• New users with full privileges.
• System service access.
• Root user access.
24. Usernames cannot be the same as group names.
True or False?
• True
• False
25. To display the group(s) a user belongs to use this command:
• all
• id
• grep
• group
• whoami
26. Which command will display the groups that the root user
belongs to?
• all -t
• groups -a
• id root
• all
• group -r
27. A value of 0 in the “minimum” password aging field means
the user cannot change their password.
True or False?
• True
• False
28. The “Epoch” began on January 1, 1970.
True or False?
• True
• False
29. The last command displays reboot records…
• By default
• Never
• Only when issued by the root user
• After restarting the system
• When issued with the -p switch
30. Sudo privileges allow users to execute commands as
another user.
True or False?
• True
• False
31. When using the sudo command to execute a command as
the root user, the command prompts for the user’s own
password, not that of the root user.
True or False?
• True
• False
32. The first line of this command displays how long the system
has been running since being rebooted.
• su
• getent
• w
• id
• who
33. The /etc/shadow file contains encrypted passwords.
True or False?
• True
• False
34. Which command can be used to view the /var/log/wtmp file
entries?
• getent
• uptime
• getpasswd
• uppasswd
• last
NDG Linux Essentials 2.0 Chapter 16 Exam Answers
1. UIDs 1-499 are usually reserved for what kind of users?
• Remote log-in accounts
• Are not used for user accounts, but for group accounts
• System accounts, such as server processes
• Log-in (human) users
2. If a user is deleted, the files and directories that the user owned…
• …will have no user owner.
• …will have no UID owner.
• …will show a UID as the owner, but not user name.
• …are deleted as well.
3. Which of the following options for the useradd command allows
root to specify the UID to be associated with the account?
• -g
• -G
• -u
• -M
4. Which of the following options for the useradd command allows
root to specify supplementary groups the user will be a member
of?
• -G
• -u
• -g
• -U
5. On a system that does not use UPG, the useradd command will
also create a user group. For example, user bob, group bob.
True or False?
• True
• False
6. Which of the following commands will add the group extra to the
user bob‘s secondary groups in addition to bob‘s current secondary
groups?
• usermod -G extra bob
• usermod -ag bob extra
• usermod -aG extra bob
• usermod -a extra bob
7. Which option for the usermod command can be used to specify a
user’s group ID (either primary or secondary)?
(choose two)
• -s
• -g
• -S
• -G
8. For non-root users, the passwd command can only be used to
change the password of the user running the command.
True or False?
• True
• False
9. The groupmod command can be used to change a group name.
True or False?
• True
• False
10. The groupmod command can be used to change a group GID.
True or False?
• True
• False
11. The groupmod command can be used to add users to a group.
True or False?
• True
• False
12. Which of the following commands can be used to modify a
group?
• groupmod
• groupadd
• modgroup
• addgroup
13. Which command can be used to determine a user’s most
recent log in?
• history
• last
• login
• shell
14. Which of the following files contains encrypted user
password information?
• /etc/usr
• /etc/group
• /etc/passwd
• /etc/shadow
15. Which of the following files contains user IDs?
• /etc/group
• /etc/passwd
• /etc/usr
• /etc/shadow
16. Which of the following files does the groupadd command use
to determine the new GID when a GID isn’t specified?
• /etc/usr
• /etc/shadow
• /etc/passwd
• /etc/group
17. Which of the following commands, run as root, will prevent
the user bob from logging in?
• usermod -L bob
• usermod -l bob
• usermod -D bob
• usermod -d bob
18. What directory contains a user’s home directory?
• /user
• /
• /home
• /rootfs
19. GIDs under 500 (or 1000) are usually reserved for what kind
of groups?
• System use
• Are not used for groups, but for user accounts
• Administrators
• User private groups (UPG)
20. If a user is deleted, the files and directories that the user
owned…
• …are deleted as well.
• …will have no user owner.
• …may be important for others in the organization
• …will have no UID owner.
21. Which of the following options for the useradd command
allows you to use a different primary group then the default?
• -g
• -G
• -U
• -u
22. On a system that uses UPG, the UID must not be the same
as the GID..
True or False?
• True
• False
23. The usermod command can be used to unlock a users account
with the following option.
• -s
• -u
• -f
• -U
24. Which of the following options for the useradd command
allows you to use a different login shell than the default?
• -g
• -s
• -u
• -U
25. Which of the following commands will add the group extra to
the user jane’s secondary groups in addition to jane‘s current
secondary groups?
• usermod -a extra jane
• usermod -ag jane extra
• usermod -aG extra jane
• usermod -G extra jane
26. Which option for the usermod command can be used to
specify a user’s primary group ID?
• -g
• -S
• -G
• -s
27. For root users, the passwd command can only be used to
change the password of the user running the command.
True or False?
• True
• False
28. The userdel -r command will…
• …will prompt before deleting each file owned by a user.
• …delete the user account, but leave the user’s files by default.
• …automatically delete a user and the user’s home directory and mail spool and their
contents.
• …automatically delete a user and all the files owned by that user.
29. The groupmod command can be used to change a group
name.
True or False?
• True
• False
30. The groupmod command cannot be used to change a group
GID.
True or False?
• True
• Fasle
31. The groupdel command can be used to delete primary
groups.
True or False?
• True
• Fasle
32. Which of the following commands can be used to modify a
user?
• adduser
• moduser
• useradd
• usermod
33. Which command can be used to determine a user’s most
recent log in?
• history
• shell
• login
• last
34. The /etc/passwd file contains encrypted user password
information. True or False?
True or False?
• False
• True
35. Which of the following files contains group IDs?
• /etc/passwd
• /etc/usr
• /etc/shadow
• /etc/group
36. Which command allows you to view or change some of the
default values used by the useradd command?
• useradd -D
• useradd -r
• modvalue
• useradd -f
37. Which of the following commands, run as root, will prevent
the user jane from logging in?
• usermod -d jane
• usermod -D jane
• usermod -L jane
• usermod -l jane
NDG Linux Essentials 2.0 Chapter 17 Exam Answers
1. Which of the following commands set “other” permissions on file
to r-x?
• chmod o-r-w file
• chmod o+rx file
• chmod o=rx file
• chmod o=r+x file
2. Which of the following commands sets “other” permissions on file
to r-x?
• chmod 775 file
• chmod 776 file
• chmod 777 file
• chmod 774 file
3. Only one set (user, group, other) of permission can be changed at
once using the symbolic method.
True or False?
• True
• False
4. Which of the following are methods for setting permissions using
the chmod command?
(choose two)
• letter
• primary
• symbolic
• octal
5. The chown command can be used to change the owner and group
of a file.
True or False?
• True
• False
6. The user sysadmin will be able to read a file because they own it.
True or False?
• True
• False
7. The user sysadmin will be able to change the permissions of a file
because they own it.
True or False?
• True
• False
8. Octal notation uses the following values for the permissions
granted:
• r = 7, w = 5, x = 0
• r = 3, w = 2, x = 1
• r = 4, w = 2, x = 0
• r = 4, w = 2, x = 1
9. Which of the following permissions would allow all users to add,
view, and delete files in a directory?
• 750
• 775
• 666
• 777
10. A user cannot delete a file if they do not own it.
True or False?
• True
• False
11. The “execute” permission on a directory allows you to:
(choose three)
• Along with write permission to successfully delete the directory
• Along with read permission to successfully perform ls -l
• Along with write permission to successfully create new files
• Change to that directory or use it as part of a path
12. The “execute” permission on a file allows you to:
• Move the file to a new directory
• Delete the file
• Run the file as a script
• This permission isn’t meaningful for text files.
13. The chgrp command can be used on a file by:
• A user that belongs to the files current group
• Only the file owner
• The file owner and root
• Only root
14. The chown command can be used to change the user owner
on a file by:
• The file owner
• Only root
• The file owner and root
• A user that belongs to the files current group
15. The chmod command can be used on a file by:
• Only root
• A user that belongs to the files current group
• The file owner
• The file owner and root
16. The “execute” permission is never set on files by default.
True or False?
• True
• False
17. Which of the following chown commands will change
the myFile user ownership to the user sam and the group
ownership to administrators?
(choose two)
• chown sam administrators myFile
• chown sam.administrators myFile
• chown sam:administrators myFile
• chown sam+administrators myFile
18. The chown command permits changing group ownership
done by root only.
True or False?
• True
• False
19. The user owner of a file will always have the same or higher
permissions as “other”.
True or False?
• True
• False
20. Which of the following commands will list hidden files as
well as their ownership?
• ls -la
• ls -l
• ls -a
• ls -z
NDG Linux Essentials 2.0 Chapter 18 Exam Answers
1. The /tmp directory is a temporary directory designed as a location
where any user can create a temporary file.
True or False?
• True
• False
2. The “sticky bit” permission…
• …sets the group ownership of any new file created in a directory.
• …prevents others from removing files they don’t own from a common directory.
• …changes the group ownership of existing files in a directory.
• …prevents others from overwriting files they don’t own in common directories.
3. Which of the following commands will set the “sticky bit”
on /shared ?
• chmod 2777 /shared
• chmod 1777 /shared
• chmod 6777 /shared
• chmod 4777 /shared
4. The “setuid” permission…
• …prevents the owner of a file from being changed.
• …allows files in a directory to be manipulated as by the directory owner.
• …reports the output of a script to the owner.
• …allows a command to be run as the file owner.
5. Which of the following commands will set setuid
for /usr/bin/program?
• chmod 4755 /usr/bin/program
• chmod 2755 /usr/bin/program
• None of the above
• chmod 1755 /usr/bin/program
6. The “setgid” permission…
(choose two)
• …prevents the group owner of a file from being changed.
• …allows a command to be run as the group owner of the file.
• …allows files created in a directory to be owned by the group that owns the
directory.
• …can only be set on files.
7. Which of the following commands will set setgid on /shared ?
• None of the above
• chmod 2777 /shared
• chmod 1777 /shared
• chmod 4777 /shared
• chmod 4777 /shared
8. Which of the following long listings represents setgid set
for /shared ?
• drwxrwsrwx. 12 root group 4096 Oct 21 13:12 /shared
• drwsrwxrwx. 12 root group 4096 Oct 21 13:12 /shared
• drwxrwxrws. 12 root group 4096 Oct 21 13:12 /shared
• drwSrwxrwx. 12 root group 4096 Oct 21 13:12 /shared
9. Setting setgid on a directory…
• …will allow scripts in the directory to be executed as the group owner of the
directory.
• …is not allowed by the system.
• …does nothing.
• …will set the group owner of all files created in the directory to the group owner of
the directory.
10. Deleting a source file will break an associated hard link.
True or False?
• True
• False
11. A source and a hard link must be part of the same
filesystem.
True or False?
• True
• False
12. Deleting a source file will break an associated symbolic link.
True or False?
• True
• False
13. A source file and a symbolic link must be part of the same
file system.
True or False?
• True
• False
14. Which of the following commands would create a hard
link, link to file?
• ln file link
• ln link file
• ln -s file link
• ln -s link file
15. Which of the following commands would create a symbolic
link, link to file?
• ln file link
• ln -s link file
• ln link file
• ln -s file link
16. Which of the following ls commands, when executed, will
only show information about the directory itself?
(choose two)
• ls -h
• ld -d
• ls -ld
• ld -a
17. Which of the following directories are designed as locations
where any user can create a temporary file?
(choose two)
• /sbin
• /lost+found
• /tmp
• /home
• /var/tmp
Linux Essentials 2.0 Chapter 12 Exam Answers
Posted on November 3, 2019 by Admin 2 Comments

NDG Linux Essentials 2.0 Chapter 12 Exam Answers


1. Which of the following are valid CPU types for Intel-based
platforms?
(choose two)
• 64-bit
• 32-bit
• 48-bit
• 24-bit
2. 64 bit platforms can access more memory than 32 bit platforms.
True or False?
• True
• False
3. Choose all of the following statements that are true in regard to
virtual RAM:
(choose three)
• Virtual RAM is stored on a hard drive
• Virtual RAM is stored in the CPU
• Virtual RAM is used when available physical RAM is low.
• Virtual RAM is also called swap space
4. Which of the following are common busing systems?
(choose two)
• CPU
• BIOS
• USB
• RAM
• PCI
5. A division of a hard drive may be referred to as a _______ .
• block
• partition
• portion
• label
6. Which of the following are valid partitioning types?
(choose two)
• GPT
• PC
• MBR
• BIOS
7. The fdisk command is a tool used for working with the MBR
partitioned disks.
True or False?
• True
• False
8. Which of the following is the valid device file name for the first IDE
hard drive on the system?
• /dev/ide
• /dev/hda
• /dev/sda
• /dev/hd1
9. Which of the following are valid video cable connector types?
(choose two)
• HDA
• VGA
• AMD
• DVI
10. Which of the following commands will display CPU
information?
(choose two)
• lscpu
• cpuinfo
• lspic
• arch
• showcpu
11. What are the advantages of solid state disks when
compared to traditional spinning platter hard disks?
(choose two)
• Less heat
• Faster system boot times
• Higher capacity
• Low cost
• Low power consumption
12. Software that allows hardware devices to communicate with
the installed operating system is called?
• Instructions
• Drivers
• Packages
• Programs
13. Which of the following commands will check hard disk MBR
partitions?
(choose three)
• fdisk
• gfdisk
• gdisk
• cfdisk
• sfdisk
14. Which of the following commands will check hard disk GPT
partitions?
(choose three)
• gdisk
• sgdisk
• sfdisk
• gfdisk
• cgdisk
NDG Linux Essentials 2.0 Chapter 8 Exam Answers
1. When using the cp command, you must provide both a source
and a destination.
True or False?
• True
• False
2. Which option(s) can be used to prevent cp from overwriting an
existing file?
(choose two)
• -z
• -n
• -N
• -i
3. The command rm -r will…
• remove a directory along with any files or subdirectories.
• generate an error; -r isn’t a valid option.
• remove only empty directories.
• prompt for each confirmation before deleting each file in a directory.
4. Which option can be used with the rm command to prompt
before deleting?
• A
• -P
• l
• -i
5. The rm command can delete multiple files at once.
True or False?
• True
• False
6. Which of the following commands can be used to rename a file?
• cp
• rm
• mv
• name
7. The touch command can be used to:
(choose two)
• Update the timestamp of existing files
• Change ownership of a file
• Create new files
• Change a file’s name
8. Which of the following are glob characters?
(choose three)
• The square brackets “[” and “]”
• The question mark “?”
• The dash character “-“
• The asterisk “*”
9. The main purpose of using glob characters is to be able to provide
a list of filenames to a command.
True or False?
• True
• False
10. The asterisk character is used to represent zero or more of
any character in a filename.
True or False?
• True
• False
11. Which of these commands will return /etc/gai.conf
/etc/pam.conf /etc/ucf.conf?
(choose two)
• ls /etc/???.????
• echo /etc/???.*f
• echo /etc/*?.*o?
• ls /etc/p???.**
12. Brackets cannot be used to a represent a range of
characters.
True or False?
• True
• False
13. Which command would list files that do not begin with a “T”
or a “W”?
• echo /etc/*[TW!]
• echo /etc/!TW
• echo /etc/[!TW]*
• echo /etc/[*TW]!
NDG Linux Essentials 2.0 Chapter 9 Exam Answers
1. Compression of a file works by:
• Eliminating gaps within the file
• Consolidating multiple files into one
• Removing redundant information
• Storing most of the data on removable media and just leaving a pointer
• Removing the high order bit from each byte
2. In general, for which of the following would you want to use
lossless compression?
• An mp3 audio file
• An encrypted email
• A JPEG image
• A log file
• A movie
3. Lossy compression:
(choose three)
• Usually results better compression than lossless
• Is often used with images
• Is often used with documents
• Decompresses to an identical version as the original
• Sacrifices some quality
4. You type gzip myfile.tar. What happens?
(choose two)
• myfile.tar is unarchived into the current directory
• An error; you forgot to pass the name of the output file
• myfile.tar.gz holds a compressed version of myfile.tar
• An error; you forgot to specify the file with -f
• myfile.tar is removed
5. How would you obtain output similar to the following?
6. compressed uncompressed ratio uncompressed_name
7.
278168 1016950 72.6% tags
• gzip –l tags
• gunzip –t tags
• file tags
8. Which command would you use to archive the Documents directory
and compress it with bzip2 compression?
• tar –fzc Documents documents.tbz
• tar –cf Documents documents.tbz
• tar –cjf Documents
• tar –cjf documents.tbz Documents
• tar –czf documents.tbz
9. Which flag would you pass to tar in order to have it make a new
archive?
• -t
• -c
• -n
• -x
• -j
10. Which command will show what is inside the compressed
tarball with a name of foo.tar.gz?
• tar –tjf foo.tar.gz
• tar –lf foo.tar.gz
• tar –tf foo.tar.gz
• tar –xf foo.tar.gz
• tar –tzf foo.tar.gz
11. In the command tar -cvjf foo.tbz a b c, what are a, b, and c?
• Nothing; -cvjf only expects one parameter
• File names to be added to the archive
• a is the directory that will be prepended to files; b and c are files inside it
• Matching operators; anything starting with a, b, or c will be added
• Extra flags passed to tar
12. Given the command tar –cvjf homedirs.tbz /home, which of
the following are true?
(choose two)
• Only files starting with /home will be extracted from the archive
• The command will print out each filename as it is processed
• The /home directory will be restored with the contents of homedirs.tbz
• Files that are present in the archive might overwrite files in /home
• The output file will be compressed
13. You archived your users’ directories into a file
called backup.tar.gz. You then view the archive and see the
filenames follow this convention:
home/username/somefile
How will you extract just the files for the user called fred?
• tar –xzf backup.tar.gz home/fred/
• tar –tjf backup.tar.gz /home/fred
• tar –xjf backup.tar.gz home/fred/
• tar –xzf backup.tar.gz fred
• tar –tzf /home/fred < backup.tar.gz
14. Which of the following commands will create a zipfile with
the contents of your Documents directory?
• zip –f mydocs.zip Documents
• zip -r mydocs.zip Documents
• zip –c mydocs.zip Documents
• zip mydocs.zip Documents
• zip -cf mydocs.zip Documents
15. Given a file called documents.zip, how can you see what’s in it
without extracting the files?
• zip -lf documents.zip
• unzip -l documents.zip
• unzip –list documents.zip
• zip -l documents.zip
• showzip documents.zip
16. Given a file called documents.zip, how can you extract just the
files under ProjectX?
• unzip documents.zip ProjectX/*
• unzip documents.zip | grep ProjectX
• unzip documents.zip ProjectX
• zip -x documents.zip ProjectX
• unzip -t documents.zip ProjectX
17. You try to compress a file that is already compressed. Which
of the following statements is true?
• The file will not be compressed any further than it already was
• The compression algorithm needs to be set to the “currently compressed” mode for
it to be compressed further
• The file changed while you were compressing it
• The file will be deleted
• The file will actually be uncompressed
18. Which of the following commands can be used to compress
a file?
(choose three)
• bunzip2
• cat
• zip
• bzip2
• gzip
19. The three main modes of tar are:
(choose three)
• List
• Create
• Compress
• Copy
• Extract
20. In the command tar -czf foo.tar.gz bar, what is the purpose
of the f flag?
• Tells tar to copy only files, and not directories
• Tells tar to read from the file that follows the flag
• Tells tar to write to the file that follows the flag
• Tells tar to print the name of each file as it is processed
• Specifies extra compression is to be used
21. Which two commands do the same thing?
(choose two)
• tar -czf foo.tar.gz foo
• tar -tzf foo.tar.gz
• tar -c foo | gzip > foo.tar.gz
• tar -x foo | gzip
• tar -xzf foo.tar.gz
22. Which two programs use the Lempel-Ziv-Markov chain
algorithm?
(choose two)
• xz
• lossless
• lossy
• bzip
• gzip
23. By default, the zip command replaces uncompressed files
with compressed files.
True or False?
• True
• False
NDG Linux Essentials 2.0 Chapter 10 Exam Answers
1. Error messages generated by commands are sent where by
default?
• STDERR
• STDIN
• Log files
• STDOUT
2. A successful command may, or may not print output to STDOUT.
True or False?
• True
• False
3. Which of the following commands will direct error messages to
the file, error.log?
• ls /root >> error.log
• ls /root > error.log
• ls /root 2> error.log
• ls /root $> error.log
4. A pipe allows you to…
• …send the same input to multiple commands.
• …type multiple commands at one prompt.
• …send the output of one command to another.
• …send the output of a command to a file.
5. Channel 2 is:
• STDOUT
• STDALL
• STDERR
• STDIN
6. Which of the following commands will append its output
to output.file?
• echo Testing >> output.file
• echo Testing > output.file
• output.file < echo Testing
• echo Testing -> output.file
7. Which command(s) can be used to sort the lines
of list.file alphabetically and display it on the screen?
(choose two)
• sort < list.file
• cat list.file >> sort
• echo list.file > sort
• cat list.file | sort
8. Which option of the head command will display only the first five
lines of a file?
• No option needed; head displays only five lines by default.
• -n
• -l 5
• -n 5
9. The grep command…
• …will display all the lines that begin with the specified Regular Expression.
• …will display all the lines in a file containing the specified Regular Expression.
• …will display the line numbers in a file that contain a specified Regular Expression.
• …is not case sensitive.
10. The grep command can be used with glob characters.
True or False?
• True
• False
11. Which of the following commands will display only lines that
begin with start?
• grep \start file.txt
• grep $start file.txt
• grep *start file.txt
• grep ^start file.txt
12. Which of the following commands will display only lines that
begin with test?
• grep $test* file.txt
• grep *test file.txt
• grep &test file.txt
• grep ^test file.txt
13. Which of the following commands will display lines that
contain either start or end?
• egrep ‘start|end’ file.txt
• egrep (start|end) file.txt
• egrep start end file.txt
• egrep start&end file.txt
14. Which of the following commands can be used to scroll
through a text file?
(choose two)
• some
• more
• cat
• less
15. Which option for the cut command is used to specify a
delimiter?
• -D
• -f
• =
• -d
16. Which option for the cut command is used to specify the
field?
• -d
• #
• -D
• -f
17. Which option for the wc command will print the number of
lines in a file?
• -w
• -l
• -L
• -C
18. Which option for the wc command will print the total number
of words in a file?
• -l
• -C
• -L
• -w
19. Which command can be used to print line numbers?
• num
• nl
• ln
• sort
20. The command echo "text" > file.txt will create file.txt if it
does not already exist.
True or False?
• True
• False
21. The command echo "text" > file.txt will not
overwrite file.txt if it already exists.
True or False?
• True
• False
22. The command echo "text" >> file.txt will not
overwrite file.txt if it already exists.
True or False?
• True
• Fals
NDG Linux Essentials 2.0 Chapter 13 Exam Answers
1. When you execute the dmesg command, the system displays
messages that are generated by the kernel.
True or False?
• True
• False
2. The Linux kernel mounts the following pseudo-filesystems to
provide access to information about hardware devices connected
to the system:
(choose two)

• /devices
• /proc
• /info
• /sys
3. The /proc directory contains a subdirectory for each process
present on the system.
True or False?
• True
• False
4. The Process ID (PID) of the init process is:
• 0
• 1
• 100
• varies
5. The process (ps) command shows only processes running in the
current shell by default.
True or False?
• True
• False
6. The following system load averages are displayed by
the top command:
(choose three)
• 15 minute
• 1 minute
• 10 minute
• 5 minute
7. The free command outputs statistics about:
• CPU usage
• Software usage
• Memory usage
• Disk usage
8. What directory typically contains log files?
• /proc/loc
• /log
• /usr/log
• /var/log
9. Which log file contains messages regarding authentication and
authorization?
• secure
• dmesg
• syslog
• messages
10. All log files contain only text data.
True or False?
• True
• False
11. A load average of 1.0 always means the system is fully
loaded.
True or False?
• True
• False
12. A command that will continuously update statistics about
running processes:
• tail
• head
• top
• Bottom
13. Which of the following is a valid Linux option style for
Traditional Unix:
• two dashes (–)
• slash (/)
• no dash
• a single dash (-)
14. Which file contains the information passed to the kernel at
boot time?
• /proc/kargs
• /proc/kopts
• /proc/cmdline
• /proc/kernel
15. To make changes permanent for kernel parameter files
found under /proc/sys, the following file can have entries added to
it:
• /etc/sysinfo.conf
• /etc/procctl.conf
• /etc/sysctl.conf
• /etc/procsys.conf
16. The /var directory has files that change over time.
True or False?
• True
• False
17. Information about the init process can be found in
the /proc/1 directory.
True or False?
• True
• False
18. Which of the following commands will allow you to view all
processes on the system?
(choose two)
• ps -ef
• ps
• ps -A
• ps aux
• ps -eLf
19. The logging daemon on recent Linux distributions based on
systemd is called:
• klogd
• journald
• rsyslogd
• syslogd
20. What does the acronym FHS stand for among the the
standards supported by the Linux Foundation?
• Filesystem Hierarchy Standard
• File Hierarchy Standard
• Filesystem Hierarchy Structure
21. Which directory is the root of the filesystem?
• /sys
• /root
• /
• /home
• /var
22. The sbin directories are primarily intended to be used by the
root user.
True or False?
• True
• False
NDG Linux Essentials 2.0 Chapter 14 Exam Answers
1. Which of the following would be considered a host?
• A printer attached to the network via an IP address
• A network cable
• A CD-ROM
• The computer’s hard drive
2. A service is…
• …like an IP address.
• …a file that contains configuration information.
• …another name for a computer’s hostname.
• …a feature provided by one computer to another.
3. A network packet contains …
(choose two)
• …the IP address of the source machine.
• …a hard drive partition.
• …the name of the router.
• …the IP address of the destination machine.
4. Only servers have hostnames.
True or False?
• True
• False
5. Which of the following protocols defines how network
communication functions?
• DHCP
• DNS
• TCP/IP
• SSH
6. Which of the following are valid IPv4 addresses?
(choose two)
• 192.105.10.10.2
• 192.301.25.25
• 10.33.55.77
• 192.105.10.10
7. Which of the following commands will display the IP address on a
Linux system?
• ifconfig
• dig
• route
• ipconfig
8. Which of the following commands will display the routing table?
(choose two)
• dig
• netstat -r
• ifconfig
• route
9. Which of the following commands will allow you to log into a
remote machine?
• dig
• netstat
• route
• ssh
10. What option to the netstat command has information shown
as numbers rather than names?
• –name
• -r
• -t
• -n
11. Which of the following commands will allow you to log into
the machine server1 with the account name nick?
• ssh nick&server1
• ssh nick-server1
• ssh nick@server1
• ssh nick->server1
12. The RSA key fingerprint allows the dig command to connect
to remote systems.
True or False?
• True
• False
13. When looking at the primary IPv4 configuration file, if the
device was configured to be a DHCP client, then the BOOTPROTO
value would be set to none.
True or False?
• True
• False
14. When issuing the service network restart command, which of
the following occurs?
• …brings up all network interfaces, re-reads all related configuration files and then
the networking for the system is restarted.
• …the networking for the system is stopped and then started back up.
• …takes down all network interfaces, re-reads all related configuration files and then
the networking for the system is restarted.
15. Which of the following files contains the IP addresses of the
name servers the system should consult in any attempt to resolve
names to IP addresses?
• /etc/nsswitch.conf
• /etc/resolve.conf
• /etc/hosts
• /etc/resolv.conf
16. Which of the following commands can be used to display
socket statistics, and supports all major packet and socket types?
• ss
• ifconfig
• route
• top
NDG Linux Essentials 2.0 Chapter 11 Exam Answers
1. A file begins with #!/bin/csh. This means:
• This is a Perl script
• The operator should not be using /bin/csh
• C Shell compatibility mode is enabled
• Running the script will invoke /bin/csh to interpret the rest of the file
• Nothing, this is a comment
2. Which are appropriate editors for writing shell scripts?
(choose two)
• Firefox
• /bin/bash
• LibreOffice Writer
• vi
• nano
3. Most of nano’s commands take the form of:
• Mouse clicks
• Escape followed by another character
• Control and another character
• The F1 through F12 function keys
• Alt and another character
4. What does this shell script do?
5. FOO=/tmp/foo

6. if [ ! –d $FOO ]; then

7. mkdir $FOO

fi

• Creates /tmp/foo if it does not exist


• Outputs a message to the screen
• Creates /tmp/foo and raises an error if there is a problem
• Nothing, since there is a problem with the conditions in the if statement
• Makes the /tmp/foo directory if a file by that name exists
8. Which of the following are correct about for and while loops?
(choose two)
• for loops have a test each cycle to determine if it should run again
• for loops operate over a fixed list of items
• for loops require a variable over which to iterate
• while loops operate over a fixed list of items
• while loops have a test each cycle to determine if it should run again
9. Given the following part of a script:
10. if [ -f $1 ]; then

11. echo “I am here”

12. fi

What is the meaning of $1?


• It is a parameter to -f, indicating the size of the file
• It is the first argument passed to the script
• It is a special variable that indicates the exit code of the command before it
• It is a file called $1
• It is a list of files that gets interpolated
13. Given the following script that is run through ./test.sh hello
goodbye:
14. if [ -f $2 ]; then

15. echo "I am here"

16. fi

When will “I am here” be printed?


• If a file called “goodbye” exists in the current directory
• Never
• The script will always print “I am here”
• If there are two files in the current directory
• If a file called “hello” exists in the current directory
17. What is the correct way to assign the word “Hello” to a
variable?
• A = “Hello”
• echo “Hello” &gt; A
• echo $A “Hello”
• $A=”Hello”
• A=”Hello”
18. What is the correct way to save the current directory to a
variable?
• A=`pwd`
• pwd | $A
• A=cwd
• A=pwd
• pwd $A
19. Which shell command accepts input from the user’s
keyboard?
• echo
• read
• gets
• input
• $1
20. What information is held inside $? ?
• The name of the command run
• The previous command’s exit code
• The number of arguments passed to the script
• The current process id
• The current user ID
21. How would you finish your script with an exit code of 42?
• return 42
• break 42
• CODE=42
• exit 42
• $?=42
22. The if command looks for what exit code to consider a
condition to be true?
• 1
• 0
• 2
• 10
• 255
23. The number of users logged in is in a variable called USERS.
How would you test to see if 5 users are logged in?
• test $USERS –eq 5
• test –f USERS=5
• test $USERS = 5
• test $USERS,5
• test $USERS –a 5
24. Given the following script:
25. while [ ! –f /tmp/foo ]; do

26. echo –n “.”

27. process_data > /tmp/foo

28. done

Which of the following are true?


(choose two)
• The screen will fill with dots.
• If a file called /tmp/foo exists, process_data won’t be run
• process_data will be called at most once
• process_data will never be run
• /tmp/foo will be removed if it exists
29. A conditional that lets you make multiple comparisons with
a pattern is called:
• fanout
• case
• if
• branch
• test
30. What is the meaning of $(( $i + 1)) ?
• 1 will be added to the i variable
• If i is 0, the loop will stop
• This will return the value of the next argument to the script
• This will return the value of the first argument to the script
• This runs the command stored in variable i
31. How would you write a test that says “if /tmp/foo is a
directory or USERS is greater than 5”?
• test –d /tmp/foo –o $USERS –gt 5
• test –d /tmp/foo | $USERS > 5
• test /tmp/foo || $USERS > 5
• test /tmp/foo –d –o $USERS -gt 5

You might also like