stottj / Command-Line

0 stars 0 forks source link

Compress and decompress files #13

Closed stottj closed 1 year ago

stottj commented 1 year ago

Summary

Learn how to compress and decompress files using various utilities like tar, gzip, zip, and unzip on a Unix-like operating system.


Description


Learning Tasks

  1. Compressing Files:

    • Learn how to use gzip and zip to compress individual files or directories.
  2. Decompressing Files:

    • Get acquainted with gunzip and unzip for decompressing files back to their original state.
  3. Archiving with tar:

    • Understand how to create compressed archives using the tar command and various flags.
  4. Best Practices:

    • Discover the best practices for compression and decompression, like choosing formats and checking integrity.
  5. Hands-on Practice:

    • Exercise 1: Compress a single file using gzip.
    • Exercise 2: Decompress the file you compressed in Exercise 1 using gunzip.
    • Exercise 3: Create a compressed archive using tar with multiple files.
    • Exercise 4: Extract the files from the compressed archive created in Exercise 3.
  6. Troubleshooting:

    • Address common issues you might face during compression and decompression and learn how to resolve them.

Learning Goals


Priority

stottj commented 1 year ago

Ex 1

gzip test.txt

Ex 2

gzip -d test.txt.gz

Ex 3

tar -czvf archive.tar.gz test.txt test1.txt test3.txt

Ex 4

tar -xzvf archive.tar.gz

Common problems: Check and make sure the file is .gz before trying to decompress it. Getting error while decompression might mean you dont have enough disk space. If you get unknown compression method your gzip might not support the cpomression method.

tupleHunden commented 1 year ago

Looks good to me, these utils are really common but I still never remember the correct tar syntax and look it up each time.