![]() Although this doesn’t guarantee the actual contents of the file, it’s a good place to start. The first step in recognizing a compressed file is to check its extension. But in the case of compress, the relevant package on Debian and Fedora is ncompress. The check at the beginning of the script reports any missing compression utility, whose package name is usually the name of the program itself. # Compress test1.txt with various compressorsĮcho "All sample compressed files were created successfully." Tar -zstd -cf test1.txt test2.txt test3.txt # Create tape archive file compressed with zstd Tar -xz -cf test1.txt test2.txt test3.txt # Create tape archive file compressed with xz # Create tape archive file compressed with 7z (requires p7zip-full package)ħz a test.tar.7z test1.txt test2.txt test3.txt Tar -lzop -cf test1.txt test2.txt test3.txt # Create tape archive file compressed with lzop Tar -lzma -cf test1.txt test2.txt test3.txt ![]() # Create tape archive file compressed with lzma Tar -lzip -cf test1.txt test2.txt test3.txt # Create tape archive file compressed with lzip ![]() # Create tape archive file compressed with lrzip # Create tape archive file compressed with compress # Create tape archive file compressed with bzip2 # Create tape archive file compressed with gzip Zip test.zip test1.txt test2.txt test3.txt Rar a test.rar test1.txt test2.txt test3.txt Please install it and try again."ħz a -t7z test.7z test1.txt test2.txt test3.txt If ! command -v "$program" &> /dev/null thenĮcho "Error: $program is not installed. Required_programs=("7z" "rar" "zip" "gzip" "bzip2" "compress" "lrzip" "lzip" "lzma" "lzop" "xz" "zstd") # Check for the presence of required compression programs Let’s save this Bash script as create_compressed_files.sh and run it to create enough test files to cover a wide range of compressed file types commonly used in the Linux world: #!/bin/bash
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |