Created
October 2, 2025 09:19
-
-
Save aslamanver/6decd2d2947bcbfe1af605b13690d798 to your computer and use it in GitHub Desktop.
CLI Compress current directory: tar -czf file.tar.gz ./* View contents of a tar.gz file: tar -tzf file.tar.gz Extract a tar.gz file: tar -xzf file.tar.gz Encryption/Decryption bash <(curl -s https://aslamanver.github.io/cli/enc.sh)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| read -p "Encrypt (e) or Decrypt (d)? " choice | |
| read -p "File name: " file | |
| [ ! -f "$file" ] && { echo "File not found!"; exit 1; } | |
| case $choice in | |
| e|E) | |
| openssl enc -aes-256-cbc -salt -pbkdf2 -iter 2000000 -in "$file" -out "${file}.enc" | |
| echo "Encrypted: ${file}.enc" | |
| ;; | |
| d|D) | |
| output="${file%.enc}" | |
| openssl enc -d -aes-256-cbc -salt -pbkdf2 -iter 2000000 -in "$file" -out "$output" | |
| echo "Decrypted: $output" | |
| if [[ "$output" == *.tar.gz ]]; then | |
| echo "Archive contents:" | |
| tar -tzf "$output" | |
| fi | |
| ;; | |
| *) | |
| echo "Invalid choice!" | |
| exit 1 | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment