Tar basic commands to store and extract files

Targeted is an archiving program designed to package, store, and compress multiple files into a single portable package the name tar is an abbreviation for tape archiver

Apart from creating .tar archives tar is also capable of compressing files using zip, bzip2, and gzip compression algorithms

Tar flags

c — compress directive
x — extract directive
t — tabulate contents
f — specify filename
z — use zip/gzip compression

j — use bzip2 compression
k — do not overwrite
t — files from file
w — ask for configuration
v — verbose

gzip flags

d — decompress file

Tar commandline commands syntax

tar -{arguments} {params}

Example tar commands

tar -cf music.tar music.mp3

Tar archiver will be directed to compress music.mp3 into a tar archive named music.tar and save it in the current working directory

tar -xf music.tar

Tar will be directed to extract music.tar archive and save the constituent contents of the archive in the current working directory

how to make a zip archives using tar

Tar can compress zip files as well, it comes of handy on minimal operating systems such as alpline and 'busybox shell' where space is a concern and therefore zip and unzip utility programs are not included within the operating system, zipping can be done using the 'z' flag

tar -czf music.zip music.mp3

Tar is instructed to compress archive using zip compression algorithm

Gzip command line syntax

gzip —{arguments} {params}

Example gzip commands

gzip filename

Gzip will create an archives prefixed with the filename in the current working directory

gzip -d archive.gz

Gzip will decompress the archive into it's uncompressed fomart


Popular posts from this blog

Snake monochrome (JS1024)

What is 'this.' keyword in JavaScript

Open-graph meta data tags introdution

what is 'array.includes' function in JavaScript

How to create zip archives in nodejs