3.1 Command Line - Archiving Files on the Command Line Flashcards
What command would you use to create a new archive of /tmp/Archive (named archive.tar.bz2) with bz2 compression?
A) tar cbvf archive.tar.bz2 /tmp/Archive
B) tar cjf archive.tar.bz2 /tmp/Archive
C) tar cvzf archive.tar.bz2 /tmp/Archive
D) bzip2 archive.tar.bz2 /tmp/Archive
tar cjf archive.tar.bz2 /tmp/Archive
j is the command for creating bzip2 or bz2 compression
What command would you use to unpack the gzip-compressed archive archive.tgz?
A) tar xvf archive.tgz
B) gunzip archive.tgz
C) tar xjf archive.tgz
D) tar xzf archive.tgz
tar xzf archive.tgz
Does zip support different compression levels?
Yes. You would use -#, replacing # with a number from 0-9.
When extracting files, does tar support globs in the file list?
Yes, you would use the –wildcards option. –wildcards must be placed right after the tar file
when using the no dash style of options.
For example:
$ tar xf tarfile.tar –wildcards dir/file
$ tar –wildcards -xf tarfile.tar dir/file*
To extract the file file.txt from the tar archive ./archive.tar, you would use the following command:
A) tar -af file.txt ./archive.tar
B) tar -rf ./archive.tar file.txt
C) tar -xf file.txt ./archive.tar
D) ** tar -xf ./archive.tar file.txt**
tar -xf ./archive.tar file.txt
What command will list the contents of an archive?
tar -t
What command will append to an archive?
tar -r