Friday, July 16, 2021

UNIX File Zipping and unzipping Commands

There are various file compression and un compression commands in UNIX.


1) Unzip the gz file we wil use the gunzip command

 
if we need to see the contents of the file without unzipping the file we can use -c option. This will enable to view file without unzipping

gunzip -c filename.gz

need  The below command use to uunzip the file completly

gunzip filename.gz




2) to Zip the txt,csv,dat etc file into gz format we wil use the gzip command

gzip  file.txt 

The above command will convert the file.txt to file.txt.gz format.


Also we can zip the file 


3) To compress the folder and its contents we use the tar command


tar -cvf filename.tar /opt/sw/SrcFiles/backup


The above command compress the folder and its contents that include its subfolders into a single tar file.

tar -xvf filename.tar

The above command un-compress the folder and its contents that include its subfolders into a single tar file.


4) We can use the unzip command to unzip the .zip file for that we need to install the 7zip software in unix.

unzip file.zip









No comments: