Explanation: gzip, gunzip, zcat - compress or expand files 'gzip' reduces the size of the named files using Lempel-Ziv coding. Whenever possible each file is replaced by one with extension .gz while keeping the same ownership modes, access and modification times. If no file is specified then standard input is compressed to standard output. gzip will attempt to compress only regular files. Ex: gzip file Will compress the file and name it as file.gz Compressed files can be restored to their original form using gzip -d or gunzip or zcat. 'gunzip' takes a list of files on command line with extension .Z, .z, .gz and replaces each file uncompressing it without the original extension. Ex: gunzip file.gz Will uncompress file.gz and replace it as file removing extension .gz. 'zcat' command will uncompress files with extensions .gz and .Z and write the uncompressed data onto standard output. Ex: zcat file.Z Will uncompress file.Z and write its contents to stdout.
How do I gzip more than one file in a single zip file? If I provide : gzip file1 file2, it created two gzip files . The simplest way to make an archive of more than one file is as follows: 1) Create a temporary folder
This will create a zipped and tared archive called archivename.tar.gz of every file in the current directory and in subdirectories under it. The file can be extracted into the current directory with:
tar zxvf archivename.tar.gz
Deleting the first line of .gz file I have too many .gz files (test.gz). Task is to remove first line of each file. Can I do it without unzipping the files? Most important thing is to backup these files before you try doing "mass" updates like these. Then try something like: Code: for files in *.gz
Or Without the command "gzip" but with the command "gzcat"... for files in *.gz
Have a Unix Problem
Unix Books :-
Return to : - Unix System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|