Thursday, February 5, 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:
Linux extract commands
gunzip filename.gzcoommand will delete original file after extraction
bzip2 -d filename.bz2coommand will delete original file after extraction
bzip2 -dk filename.bz2this command also extracts but keep original
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.