IF YOU JUST SOLVED SOME PROBLEM, WELCOME TO DM qaRabbit ON TWITTER, OR CREATE A PULL REQUEST IN GITHUB REPO.
macOS
- 
file.zip extract to the current directory unzip file.zipextract to the target directory unzip file.zip -d target_dir_pathcompress to file.zip zip file path1 path2 path3
- 
file.tar (archive, no compress) extract to the current directory tar -xvf file.tarextract to target_dir_path (must be created first) mkdir -p target_dir_path && tar -C target_dir_path -xvf file.tarcompress path tar -cvf file.tar path1 path2
- 
file.tar.gz file.tgz tar.gz file is a Tar archive compressed with Gzip extract to the current directory tar -zxvf file.tar.gzextract to target_dir_path (must be created first) mkdir -p target_dir_path && tar -C target_dir_path -zxvf file.tar.gzcompress path tar -czvf file.tar.gz path1 path2 ...compress with exclude tar -czvf file.tar.gz path --exclude=sub_path1 --exclude=sub_path2tar -czvf file.tar.gz path --exclude={sub_path1, sub_path2}tar -czvf file.tar.gz path --exclude=*.ext
- 
file.tar.xz tar.gz file is a Tar archive compressed with Xz a LZMA based compress algorithm tar auto-detects compression type and extracts the archive tar -xf file.tar.xz
- 
file.tar.bz2 file.tbz tar.bz2 file is a Tar archive compressed with Bzip2 extract to the current directory tar -xvf file.tar.bz2extract to target_dir_path (--directory, -C; must be created first) mkdir -p target_dir_path && tar -xvf file.tar.bz2 -C target_dir_pathextract specific files tar -xf archive.tar.bz2 file1 file2 dir1 dir2tar -xf archive.tar.bz2 --wildcards '*.md'extract from stdin wget -c ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2 -O - | sudo tar -xjlist archive content (--list, -t) tar -tvf file.tar.bz2compress path tar -cjvf file.tar.bz2 path1 path2
GNU/Linux
References:
- https://www.cyberciti.biz/faq/linux-howto-unzip-files-in-root-directory/
- https://www.hostingmanual.net/zipping-unzipping-files-unix/
- https://linuxize.com/post/how-to-create-and-extract-archives-using-the-tar-command-in-linux/
- https://linuxize.com/post/how-to-extract-unzip-tar-bz2-file
- https://www.pendrivelinux.com/how-to-open-a-tar-file-in-unix-or-linux/
- https://www.howtogeek.com/248780/how-to-compress-and-extract-files-using-the-tar-command-on-linux/
- https://unix.stackexchange.com/questions/25311/create-target-directory-when-extracting-tarball
 

 
    
Top comments (0)