Lesson 3 Flashcards
(43 cards)
How does compression work?
By replacing repetitive patterns in data. For example finding a common word and replacing it with something else then creating a map to that replacement (obv more complex)
What are the two types of compression?
Lossless and Lossy
When is lossy compression often used?
For images, video or audio where loss in the original data has a marginal effect
Name some common lossless compression tools
bzip2, gzip, xz
What is the most common archiving tool?
tar
how do you uncompress? name the common commands
bunzip2, gunzip, unxz
How can you increase or decrease the level of compression?
By using -1
through -9
…common among all compression tools
what is the syntax for a tar command to compress?
tar -cf newfile pathtoarchive
what is the syntax to untar?
tar -xf <file/path>
When using tar with gzip, bgzip2 and xz what are the commands?
gzip = tar -xzf
bzip2 = tar -xjf
xz = tar -xJf
syntax to zip recursively
zip -r filename filepath
syntax to unzip
unzip filename
how to output the contents of a compressed file?
zcat gzip, bzcat for bzip2
how do add a file to a compressed tar?
First you need to uncompress it so gunzip or bunzip2 or unxz…then use tar uf to add a new file
how to view contents of a tar without extracting it?
tar -tf filename
Which tar option instructs tar to include the leading “/” in the absolute paths?
-P
Does zip support multiple compression levels?
Yes same as the other compression tools
When extracting and archive, does tar support wildcards?
Yes with the –wildcards option
How can you ensure decompressed files are lossless?
bzip2, gzip, and xz all have checksums built in to ensure this
What is I/O redirection?
Enabled you to redirect information from or to a command by using a text file
Which character to redirect std out to a file?
>
for example echo "hello world" > text
Which characters to redirect std out but add to a file?
>>
Which characters to redirect errors to a file?
2>
How to redirect standard input to a command?
<
example: cat < text