Tar Flashcards
What does tar stand for?
tape archive
tar can quickly join together multiple files into one larger file, while still preserving ______.
meta-data such as Unix permissions
By default, tar does not compress files, but it does have a flag that will compress the archive using ____.
gzip
A very simple archive built using tar is called a _____.
tarball
How would we create a tarball of all of the files in the tools directory?
tar -c tools/
What is the “gibberish” preceding each of the files that make up a tarball?
Unix meta-data of that file; including such things as the permissions, file’s owner, group, etc.
If you don’t use the -f flag when using tar, where does the archive go?
It’s printed to stdout, which is useful when you want to pipe the output of the archive into another command.
How would you create a tarball and save it to a file?
tar -cf foo.tar tools/
[command] [flags] [file to be created] [directory]
What flag can we use to see which files are being added to the archive?
-v
verbose mode
How can we pass multiple directories to the tar command?
just tack them on at the end
How can we create a tarball from a list of files generated by a find command?
find . -name *.gemspec | tar -cvf gemspecs.tar -T -
- T flag reads in a list of file names from another file
- tells tars that it should read in the list of files from the find query
What does the -T flag do?
Reads in a list of file names from another file.
How can you list the files in an existing archive?
using the -t flag
tar -tf foo.tar
How can we append additional files to a non-compressed archive?
with the -r flag
tar -rvf foo.tar Gemfile README.md
How can we update a specific file within an uncompressed archive?
with the -u flag
tar -uvf foo.tar version.rb