I allways forget how to extract a *.tar.gz file from command line on Linux, so I have to write it down.

Example of extract tar file:

tar -xvf file.tar.gz

Where:
x extract
v verbose output (prints all extracted files)
f specify input filename
z decompress

Example of creating archive with tar:

tar -cvzf compressed_file.tar /path/to/directory

Where:
c create archive
v verbose output
f specify output filename
z compress

Other examples:
Create compressed archive with three files from separate directories:

tar -cvzf compressed_file.tar /path/to/file1 /path/to/file2 /path/to/file3

Related links:

http://www.cyberciti.biz/faq/tar-extract-linux/

Comments are closed.

Post Navigation