How to package files

File packaging commands enable to work with disks and files as chucks of data, irrespective to their application.

How to package files in GNU/Linux(R)

Compress a directory into a "zip" file.

Take the following command as an example.

zip -r my_archive.zip my_directory

Compress a directory into a "tar.gz" file.

Pack the files from a directory "/my/directory/" to an archive:

tar -cvzf something.tar.gz /my/directory

Same would stand for a single file.

Uncompress a "tar.gz" file.

Unpack the files from the archive into the current working directory:

tar -xvzf something.tar.gz

Uncompress a ".gz" file.

Example command below.

gunzip -k my.gz

Split big files for FAT32 disk.

Maximum file size (most generic case) for FAT32 disk is (2 GiB - 1 = 2147483647 bytes).

Use a command like the following to split the file "mybiggame.dmg" (2097151 KiB pieces):

tar -cvM -L 2097151 -f mysmgames.tar mybiggame.dmg

Copy a directory to a file as an "ISO".

Take the following commands as examples.

xorrisofs -v -J -r -V MY_DISK_LABEL -o /home/user/file.iso /home/user/for_iso
or
genisoimage -v -J -r -V MY_DISK_LABEL -o /home/user/file.iso /home/user/for_iso

For big files (more than 4 GB), add an option like this:

xorrisofs -v -J -r -iso-level 3 -V MY_DISK_LABEL -o /home/user/file.iso /home/user/for_iso

Warning: in Debian they recommend to use rather "xorrisofs" than "genisoimage".

Uncompress a "7z" file.

Display the list of files in the 7z file:

7z l my_archive.7z

Uncompress 7z file into the current working directory:

7z x my_archive.7z

Uncompress a "tar.bz2" file.

Take the following command as an example.
tar -xvjf my_compress_file.tar.bz2

Uncompress a "tar.xz" file.

Take the following command as an example.
tar -xvJf my_compress_file.tar.xz

How to package files in Microsoft Windows

N/A

How to package files in AppleĀ® macOSĀ®

Copy a directory to a file as an "ISO".

Take the following command as an example.

hdiutil makehybrid -o my_disk_image.ISO my_source_directory -iso -joliet

Trademark notices

Apple(R), MacBook(R), MacBook Air(R), MacBook Pro(R), iTunes(R), iBooks(R), App Store(R), iCloud(R), iMessage(R), FaceTime(R), Safari(R), FileVault(R), MagSafe(R), Touch Bar(TM), and macOS(R) are registered trademarks of Apple Inc. in the United States and other countries.
Linux(R) is registered trademark of Linus Torvalds in the United States and other countries.


Copyright (c) 2022 Leonid Dorogin