unpack an archive
Open any common archive: tar, zip, gz, xz, 7z, rar.
Steps
-
tar -xf archive.tar.gzany tar: .tar, .tar.gz, .tgz, .tar.xz, .tar.zst
-
tar -xf archive.tar.gz -C /destinto another folder
-
unzip archive.zip -d foldera zip, into a folder
-
gunzip file.gza single .gz file
-
xz -d file.xza single .xz file
-
7z x archive.7z7z, and most other kinds (p7zip)
-
unrar x archive.rarrar, if unrar is installed
Notes
tar -tfandunzip -llist what is inside first.
Commands used
tarunzip7zgunzip
Each has a page in lore: lore tar opens it.
Related recipes
- compress a folderPack a folder into one compressed file, look inside it, and unpack it again.
- pack a folder without some filesMake a tar archive of a folder, leaving out folders like node_modules and files like logs.
- add to the end of a fileAdd lines to a file without replacing it, also to a file only root can write.
- argument list too long"Argument list too long" from rm, cp or mv: too many files for one command line. Hand them over in batches.