Compressed Files

    Compressing files πŸ”—

    Using target file extension πŸ”—

    Only tested and confirmed to work with:

    • .tar.xz
    • .tar.gz
    tar -caf archive.tar.xz file1 file2 file3
    

    Can be used with * to include all files in folder

    tar -caf archive.tar.xz *
    

    Specify compression πŸ”—

    Compression options πŸ”—

     -a, --auto-compress        use archive suffix to determine the compression program
    -j, --bzip2                filter the archive through bzip2
    -J, --xz                   filter the archive through xz
        --lzip                 filter the archive through lzip
        --lzma                 filter the archive through xz
        --lzop                 filter the archive through lzop
        --zstd                 filter the archive through zstd
    -z, --gzip, --gunzip, --ungzip   filter the archive through gzip
    

    Example πŸ”—

    tar -cf archive.tar.xz file1 file2 file3 --xz
    

    Extracting files πŸ”—

    TAR πŸ”—

    tar -xf archive.tar.xz
    

    Tar relevant switches πŸ”—

    Taken from help message

    • -x, --extract, --get extract files from an archive
    • -c, --create create a new archive
    • -f, --file=ARCHIVE use archive file or device ARCHIVE
    • -a, --auto-compress use archive suffix to determine the compression program
    • -z, --gzip, --gunzip, --ungzip filter the archive through gzip
    • -v, --verbose verbosely list files processed

    Zip πŸ”—

    unzip archive.zip
    

    Uncompress .Z files πŸ”—

    Source: https://www.linuxfordevices.com/tutorials/linux/uncompress-z-file

    uncompress archive.z
    

    or

    gzip -d archive.z