Skip to content

Latest commit

 

History

History
138 lines (106 loc) · 2.23 KB

File metadata and controls

138 lines (106 loc) · 2.23 KB

Archive Commands

ZIP

Create a ZIP archive

Compress all files in current directory

zip archive.zip *

Compress a directory and its contents (recursive)

zip -r archive.zip directory_name/

Compress multiple specific files

zip archive.zip file1.txt file2.jpg document.pdf

Compress with password protection

zip -e archive.zip file1.txt file2.jpg

Extract a ZIP archive

Extract to current directory

unzip archive.zip

Extract to a specific directory

unzip archive.zip -d /path/to/extract/

Extract a specific file from archive

unzip archive.zip specific_file.txt

List contents without extracting

unzip -l archive.zip

Test archive integrity

unzip -t archive.zip

TAR Commands (common on Linux/Unix)

Create TAR archives

Create a tar archive

tar -cvf archive.tar directory/

Create a gzipped tar archive

tar -czvf archive.tar.gz directory/

Create a bzip2 compressed tar archive

tar -cjvf archive.tar.bz2 directory/

Extract TAR archives

Extract a tar archive

tar -xvf archive.tar

Extract a gzipped tar archive

tar -xzvf archive.tar.gz

Extract a bzip2 compressed tar archive

tar -xjvf archive.tar.bz2

Extract to a specific directory

tar -xvf archive.tar -C /path/to/extract/

Other Archive Commands

7z (7-Zip)

Create a 7z archive

7z a archive.7z directory/

Extract a 7z archive

7z x archive.7z

RAR

Create a RAR archive

rar a archive.rar directory/

Extract a RAR archive

rar x archive.rar

Command Options Explained

ZIP Options

  • -r: Recursive (include subdirectories)
  • -e: Encrypt (password protect)
  • -q: Quiet mode (less verbose)
  • -d: Specify destination directory for extraction
  • -l: List contents without extracting
  • -t: Test archive integrity

TAR Options

  • c: Create new archive
  • x: Extract files
  • v: Verbose (show progress)
  • f: Specify filename
  • z: Filter through gzip
  • j: Filter through bzip2
  • C: Change to directory before performing operations