Using tar to Archive, Extract, Compress, and Uncompress Files
• Scott Sanbar
Here I show how to use the Linuxtar command to create uncompressed tarballs (archives) and tarballs compressed with various
compression algorithms of all files and directories in the current working directory. I also show how to simultaneously uncompress (if necessary)
and extract all the files into the current working directory.
All the above commands were tested on an Ubuntu 18.04.4 LTS (bionic). For complete details, see the Ubuntu man page for tar.
Here is a breakdown of all the options used above directly from the man page:
create a new archive
-x, –extract, –get
extract files from an archive
verbosely list files processed
filter the archive through gzip
filter the archive through bzip2
filter the archive through xz
use archive file or device ARCHIVE
You can combine these options together without the need for any dashes as I have done above. There is no need to have an = sign between the f
option and the filename for the archive.