Tar

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

tar xvf filename.tar -> untar

gzip -dfvr -> un-gzip

Assume floppy drive is a 3.5" drive at /dev/fd0

Copy to disk:

tar -c -f /dev/fd0 -L1440K -M <File-Name> Copy from disk:

tar -x -f /dev/fd0 -L1440K -M <File-Nam

[LIST CONTENTS OF COMPRESSED TAR ARCHIVE]


List contents of filename.tar to the screen

tar -tvf filename.tar

List the contents of a gnuzip (gzip) compressed tar archive.

tar -ztf name-of-file.tgz

Verbosely

tar -ztvf name-of-file.tgz

Search the archive

tar -ztf name-of-file.tgz | grep -i "search string"

Verbosely

tar -ztvf name-of-file.tgz | grep -i "search string"

Online Resources

[HOWTO EXTRACT xz / tgz FILE IN LINUX]

The xz format is a single-file compression format that is based on the LZMA2 algorithm. Requires xz toos. Mint/Ubuntu install

sudo apt install xz-utils

extract/unzip xz tar file

tar -xvf userfiles.tar.xz

Archive types tar.gz and tar.xz are both compressed tar-files, however, using variations on the compression method. For the user there is no difference when extracting either type of file, with the exception of extraction speed. The compression method for xz produces a more densely compact file resulting in a higher level of compression at the expense of speed. It may take longer, or even significantly longer to extract files from a xz archive.

[HOWTO COMPRESS with tar zip tar.gz tgz]

Back up a directory of files and preserve the path.

tar -zcvf sourcefiles archive.tar.gz
  • -z compress using zip
  • -c create
  • -v verbose
  • -f archive file to create

You can add -p to preserve absolute names, so that the path will begin with the root / and all the way to the directory location. This is really only useful for doing backups/