KEMBAR78
Linux Essentials Chapter 7 Exam Answer | PDF | Zip (File Format) | Linux Distribution
0% found this document useful (0 votes)
3K views18 pages

Linux Essentials Chapter 7 Exam Answer

The document contains questions and answers about Linux commands for compressing, archiving, searching, and manipulating files. Compression removes redundant data to reduce a file's size. The tar command is used to archive multiple files into a single file, and options like -c create an archive, -x extracts files, and -f specifies the archive file. The grep command searches for text patterns in files, while less and more allow scrolling through file contents. Pipes send output from one command into another to filter or manipulate the data.

Uploaded by

rrenattavs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views18 pages

Linux Essentials Chapter 7 Exam Answer

The document contains questions and answers about Linux commands for compressing, archiving, searching, and manipulating files. Compression removes redundant data to reduce a file's size. The tar command is used to archive multiple files into a single file, and options like -c create an archive, -x extracts files, and -f specifies the archive file. The grep command searches for text patterns in files, while less and more allow scrolling through file contents. Pipes send output from one command into another to filter or manipulate the data.

Uploaded by

rrenattavs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Linux Essentials Chapter 7 Exam Answer

1. Question ID 73

Compression on a file works by:

 Removing redundant information


 Eliminating gaps within the file
 Storing most of the data on removable media and just leaving a pointer
 Consolidating multiple files into one
 Removing the high order bit from each byte
2. Question ID 75

In general, for which of the following would you want to use lossless
compression?

 A log file
 A movie
 A JPEG image
 An mp3 audio file
 An encrypted email
3. Question ID 76

Lossy compression:

(choose three)

 Decompresses to an identical version as the original


 Is often used with documents
 Is often used with images
 Usually results better compression than lossless
 Sacrifices some quality
4. Question ID 77

You type gzip myfile.tar. What happens?

(choose two)

 myfile.tar is removed
 myfile.tar.gz holds a compressed version of myfile.tar
 An error; you forgot to specify the file with –f
 myfile.tar is unarchived into the current directory
 An error; you forgot to pass the name of the output file
5. Question ID 78

How would you obtain output similar to the following?


compressed uncompressed ratio uncompressed_name

278168 1016950 72.6% tags

 gunzip –t tags
 file tags
 gzip –l tags
6. Question ID 79

Which command would you use to archive the Documents directory and
compress it with bzip2 compression?

 tar –czf documents.tbz Documents


 tar –cjf Documents
 tar –fzc Documents documents.tbz
 tar –cjf documents.tbz Documents
 tar –cf Documents documents.tbz
7. Question ID 80

Which flag would you pass to tar in order to have it make a new archive?

 –t
 -c
 –j
 -x
 –n
8. Question ID 81

Which command will show what is inside the compressed tarball with a name of
foo.tar.gz?

 tar –tjf foo.tar.gz


 tar –tzf foo.tar.gz
 tar –lf foo.tar.gz
 tar –xf foo.tar.gz
 tar –tf foo.tar.gz

9. Question ID 82

In the command tar –cvjf foo.tbz a b c, what are a, b, and c?

 File names to be added to the archive


 Matching operators; anything starting with a, b, or c will be added
 a is the directory that will be prepended to files; b and c are files inside it
 Extra flags passed to tar
 Nothing; -cvjf only expects one parameter
10. Question ID 83

Given the command tar –cvjf homedirs.tbz /home, which of the following are
true?(choose two)

 The /home directory will be restored with the contents of homedirs.tbz


 Only files starting with /home will be extracted from the archive
 The command will print out each filename as it is processed
 Files that are present in the archive might overwrite files in /home
 The output file will be compressed
11. Question ID 84

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 –tzf /home/fred < backup.tar.gz


 tar –tjf backup.tar.gz /home/fred
 tar –xjf backup.tar.gz home/fred/
 tar –xzf backup.tar.gz home/fred/
 tar –xzf backup.tar.gz fred
12. Question ID 85

Which of the following commands will create a zipfile with the contents of your
Documents directory?

 zip –cf mydocs.zip Documents


 zip –c mydocs.zip Documents
 zip -r mydocs.zip Documents
 zip mydocs.zip Documents
 zip –f mydocs.zip Documents

13. Question ID 86

Given a file called documents.zip, how can you see what’s in it without
extracting the files?

 showzip documents.zip
 zip –lf documents.zip
 zip –l documents.zip
 unzip –list documents.zip
 unzip –l documents.zip
14. Question ID 87

Given a file called documents.zip, how can you extract just the files under
ProjectX?

 zip –x documents.zip ProjectX


 unzip documents.zip | grep ProjectX
 unzip –t documents.zip ProjectX
 unzip documents.zip ProjectX
 unzip documents.zip ProjectX/*
15. Question ID 88

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 will actually be uncompressed
 The file will be deleted
 The file changed while you were compressing it
16. Question ID 89

Which of the following commands can be used to compress a file?(choose three)

 bunzip2
 bzip2
 gzip
 cat
 zip
17. Question ID 90

The three main modes of tar are: (choose three)

 Copy
 List
 Compress
 Create
 Extract
18. Question ID 91

In the command tar –czf foo.tar.gz bar, what is the purpose of the f flag?

 Tells tar to read from the file that follows the flag
 Tells tar to print the name of each file as it is processed
 Tells tar to copy only files, and not directories
 Specifies extra compression is to be used
 Tells tar to write to the file that follows the flag
19. Question ID 92

Which two commands do the same thing? (choose two)

 tar –czf foo.tar.gz foo


 tar –c foo | gzip > foo.tar.gz
 tar –xzf foo.tar.gz
 tar –x foo | gzip
 tar –tzf foo.tar.gz
20. Question ID 902

The _____ command is normally executed daily to update the database of all
files that are on the system.

 updatedb
 search
 locate
 find
Linux Essentials Chapter 8 Exam Answer

1. Question ID 93

Error messages generated by commands are sent where by default?

 Log files
 STDOUT
 STDERR
 STDIN
2. Question ID 94

A successful command will print output to STDOUT.

True or False?

 True
 False
3. Question ID 95

Which of the following commands will direct error messages to the file,
error.log?

(choose one)

 ls /root >> error.log


 ls /root 2> error.log
 ls /root $> error.log
 ls /root > error.log
4. Question ID 96

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. Question ID 97

Channel 2 is:

 STDIN
 STDALL
 STDOUT
 STDERR
6. Question ID 98
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. Question ID 99

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
 cat list.file >> sort
 echo list.file > sort
8. Question ID 100

Which option of the head command will display only the first five lines of a file?

 -l 5
 No option needed; head displays only five lines by default.
 -n
 -n 5

9. Question ID 101

The grep command…

 …will display all the lines that begin with the specified Regular Expression.
 …is not case sensitive.
 …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.
10. Question ID 102

The grep command can be used with glob characters.

True or False?

 True
 False
11. Question ID 103

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. Question ID 104

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. Question ID 105

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.

Question ID 106

Which of the following commands can be used to scroll through a text file?

(choose two)


some

less

cat

more
15. Question ID 107

The find command can search for files based on the size of the file.

True or False?

 True
 False

16. Question ID 108

Which of the following commands scans the file to determine file locations?

 search
 locate
 where
 find
17. Question ID 109

Which option for the cut command is used to specify a delimiter?

 -f
 -d
 =
 -D
18. Question ID 110

Which option for the cut command is used to specify the field?

 -D
 -f
 -d
 #
19. Question ID 111

Which option for the wc command will print the number of lines in a file?

 -l
 -w
 -C
 -L
20. Question ID 112

Which option for the wc command will print the total number of words in a file?

 -l
 -L
 -C
 -w
21. Question ID 113

Which command can be used to print line numbers?


 num
 sort
 ln
 nl
22. Question ID 114

The command echo “text” > file.txt will create file.txt if it does not already exist.

True or False?

 True
 False
23. Question ID 115

The command echo “text” > file.txt will not overwrite file.txt if it already exists.

True or False?

 True
 False
24. Question ID 116

The command echo “text” >> file.txt will not overwrite file.txt if it already exists.

True or False?

 True
 False
Linux Essentials Midterm Exam Modules 1 – 8 Answer

1. Question ID 42

To go to the end of an info page, press:

 END
 n
 N
 ]
2. Question ID 43

To go to the next match of a search on a man page, press:

 ]
 n
 N
 }
3. Question ID 44

When interpreting the SYNOPSIS of a command found on a man page, the “|”
means:

 The items it separates can be used together


 The items it separates cannot be used together
4. Question ID 45

After performing a search, you can use the ____ key to return to a previously
found match:

 n
 N
 D
 U
5. Question ID 46

To move a page forward one at a time while viewing a man page, press the
following:

 Spacebar
 m
 a
 Enter
6. Question ID 59

The ls command without options or arguments…


 …lists the contents of the current directory.
 …prompts for a directory to list.
 …lists the contents of a user’s home directory.
 …generates an error as this command requires arguments.
7. Question ID 68

Which option can be used with the rm command to prompt before deleting?

 I
 -i
 -P
 A
8. Question ID 69

The rm command can delete multiple files at once.

True or False?

 True
 False
9. Question ID 70

Which of the following commands can be used to rename a file?

 name
 rn
 mv
 cp
10. Question ID 72

The touch command can be used to:

(choose two)

 Update the time stamp of existing files


 Create new files
 Change a file’s name
 Change ownership of a file
11. Question ID 88

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 file changed while you were compressing it
 The file will actually be uncompressed
 The compression algorithm needs to be set to the “currently compressed” mode for it to be
compressed further
 The file will be deleted
12. Question ID 89

Which of the following commands can be used to compress a file?

(choose three)

 bunzip2
 zip
 bzip2
 cat
 gzip
13. Question ID 90

The three main modes of tar are:

(choose three)

 Extract
 Copy
 Compress
 List
 Create
14. Question ID 91

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 print the name of each file as it is processed
 Specifies extra compression is to be used
 Tells tar to write to the file that follows the flag
15. Question ID 92

Which two commands do the same thing?

(choose two)

 tar –xzf foo.tar.gz


 tar –x foo | gzip
 tar –c foo | gzip > foo.tar.gz
 tar –tzf foo.tar.gz
 tar –czf foo.tar.gz foo
16. Question ID 112

Which option for the wc command will print the total number of words in a file?

 -l
 -L
 -w
 -C
17. Question ID 113

Which command can be used to print line numbers?

 num
 ln
 nl
 sort
18. Question ID 114

The command echo “text” > file.txt will create file.txt if it does not already exist.

True or False?

 True
 False
19. Question ID 115

The command echo “text” > file.txt will not overwrite file.txt if it already exists.

True or False?

 True
 False
20. Question ID 116

The command echo “text” >> file.txt will not overwrite file.txt if it already exists.

True or False?

 True
 False
21. Question ID 262

Software is backward compatible if:

 It still supports old file formats or applications


 If the next version still works the same way
 People still use old versions
 It works across Linux/Mac/Windows
 It can be upgraded without downtime
22. Question ID 263

Apple’s OS X is:
(choose three)

 Derived from Linux


 Only compatible with Apple hardware
 Able to natively run Windows binaries
 Derived from FreeBSD
 Certified as UNIX compatible
 Primarily used to manage network services
23. Question ID 264

Microsoft Windows:

(choose three)

 Has a short maintenance cycle


 Comes in desktop and server variants
 Has built in virtualization
 Has a new desktop version every year.
 Has a Linux compatibility mode
 Has powerful scripting capabilities
24. Question ID 265

Other commercial Unixes:

(choose two)

 Are almost obsolete


 Are tied to their vendor’s hardware
 Use completely different commands than Linux
 Are UNIX certified
 Do not run the GNU tools
25. Question ID 266

When choosing a distribution of Linux, you should consider:

(choose five)

 Which management tools are provided by the distribution


 Which distributions are supported by the software you need to run
 Popularity on social media.
 The maintenance cycle of the distribution
 If you need support on the distribution itself
 Whether or not the distribution is under active development
26. Question ID 302

The difference between the GPL and LGPL licenses are:

 LGPL allows you to distribute the software in binary-only form


 LGPL is shorter than GPL
 LGPL allows linking to non GPLed software
 LGPL applies to web services
 LGPL was made by the OSI while GPL was made by the FSF
27. Question ID 303

Permissive free software licenses:

(choose three)

 Can allow software to be used inside closed source software


 Are not approved by the OSI
 Are not approved by the FSF
 Include the GPLv2 and BSD
 Don’t have a copyleft provision
28. Question ID 304

The Creative Commons version of Public Domain licensing is:

 Attribution-NonCommercial-ShareAlike
 Attribution-NonCommercial
 NoAttribution-ShareAlike
 No Rights Reserved
 Attribution
29. Question ID 305

Your company makes a hardware firewall that runs a custom Linux kernel. What
are your obligations under GPLv2?

 There are no requirements


 You must make the source to your custom web interface available
 You must make your hardware designs available
 You must make the source to your kernel available
 You must ensure your custom kernel runs on a regular Intel machine
30. Question ID 306

Participating in open source projects can improve your technical skills, even if it
is not your day job.

True or False?

 True
 False
31. Question ID 322

What are tradeoffs of increasing the level of privacy you have in your web
browser?
(choose two)

 You may get viruses


 Sites may not work properly
 Websites may load slower
 Images won’t load properly
 You may have to explicitly permit some cookies to be saved
32. Question ID 323

Which of the following is a tool that helps you anonymize your Internet
browsing?

 CookieCleaner
 Web proxy
 The onion router
 AnonFirefox
 iptables
33. Question ID 324

Social network “like” buttons can track your activity across the Internet.

True or False?

 True
 False
34. Question ID 325

Which of the following are properties of a strong password?

(choose three)

 A mix of upper and lower case


 Long so that it can be reused on multiple sites
 Includes symbols
 At least 10 characters long
 Based on easy to remember items like birthdays
35. Question ID 326

What can be done to prevent remote people from running programs on your
computer?

(choose two)

 Don’t use wireless networks – only wired


 Use strong passwords on all user accounts
 Turn on a firewall
 Block third party cookies
 Block all cookies
36. Question ID 343

The acronym CLI stands for:

 Computer Link Interpreter


 Command Line Interpreter
 Computer Line Interface
 Command Line Interface
37. Question ID 344

Traditional UNIX command options used a single dash, like -a; _______
command options use two dashes like –all.

 LINUX
 Kernel
 GNU
 shell
38. Question ID 345

The acronym GNU stands for:

 Gnu’s Not Unix


 Go Next Unit
 Gnu’s Nearly Unix
 Good News Unix
39. Question ID 346

What one character treats the character that follows it as if it was surrounded by
single quotes?

 /
 %
 \
 #
40. Question ID 347

The main purpose of using glob characters is to be able to provide a command a


list of filenames.

True or False?

 True
 False

You might also like