Tag Info

New answers tagged

-1

tar -cf foo.tar foo/ | xz -9 foo.tar Generates foo.tar.xz at -9 compression WITHOUT streaming, which yields a smaller file. Streaming in LZMA inflates the file by a few bytes.


2

Here is another method. You can create files by controlling the loop variable filecount. This creates random files of size between 100MB to 900 MB and gzips them. #!/bin/bash filecount=0 while [ $filecount -lt 10 ] do filesize=$((RANDOM%9+1)) filesize=$(($filesize*104857600)) </dev/urandom head -c "$filesize" | gzip > /tmp/file${filecount}.$RANDOM.gz ...


16

You can create a 10MB gzip file like this: head -c 10M /dev/urandom | gzip -1 >10m.gz This uses urandom to get a high-entropy stream of bytes: since this is incompressible, the gzipped version will be about the same size as the input. You can then catenate copies of your gzip file together: cat $(perl -e "print '10m.gz ' x 30") >300m.gz Thirty ...


0

If you don't want to extract the file you can use vim filename.war to read the contents of the file. You can read subdirectories of files by selecting them and pressing enter.


1

In complement to @apaul, I emphasize that compressing files individually bzip2 *.log.* (replace bzip2 by gzip, xz, or what ever your favorite file zip is) may be important: This way you can still see (bzcat file.bz2), search (bzgrep file.bz2), edit (vi file.bz2) the compressed file and remove the older ones when necessary.


5

I figured out a tar solution by myself. It deletes single file after compressed it into the target file. The compressing speed is not quite fast, though. The command looks like: tar -zcvf my_log.tar.gz *.log --remove-files


9

gzip or bzip2 will compress the file and remove the non-compressed one automatically (this is their default behaviour). However, keep in mind that while the compressing process, both files will exists. If you want to compress log files (ie: files containing text), you may prefer bzip2, since it has a better ratio for text files. bzip2 -9 myfile # ...


0

This is not an exact answer to your question but you could use one command instead of two: 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1 adds all files from directory "dir1" to archive archive.7z using "ultras ettings" other formats supported are: zip, gzip, bzip2 or tar. for this just replace 7z after -t. --source man 7z NOTE: don't ...


2

I found two solutions: With GNU tar, using the awesome -I option: tar -I pigz -xvf /path/to/archive.tar.gz -C /where/to/unpack/it/ With a lot of a Linux piping (for those who prefer a more geeky look): unpigz < /path/to/archive.tar.gz | tar -xvC /where/to/unpack/it/ More portably (to other tar implementations): unpigz < /path/to/archive.tar.gz | ...



Top 50 recent answers are included