Friday, February 6, 2015
linux command to extract .gz, .tar.bz2, .tar.gz files
I always forget how to decompress/extract certain file types in linux. Below I publish list of linux commands to decompress different archives:
.gz:
.bz2:
.tar.gz
Linux extract commands
.gz:
gunzip filename.gzcoommand will delete original file after extraction
.bz2:
bzip2 -d filename.bz2coommand will delete original file after extraction
bzip2 -dk filename.bz2this command also extracts but keep original
.tar.gz
tar -xvzf filename.tar.gz
- x: tar can collect files or extract them. x does the latter.
- v: makes tar talk a lot. Verbose output shows you all the files being extracted.
- z: tells tar to decompress the archive using gzip
- f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
Subscribe to:
Post Comments (Atom)
Check out dtrx command. Intelligent extraction
ReplyDeleteseems to be a great solution, didn't know before! Thanks!
Delete