To Unpack/Untar the tar.gz file:
syntax: tar - xvzf <zip_or_tar.gz_file_Name>
e.g.: tar -xvzf java8u251.tar.gz
The above command will untar the java8u251.tar.gz file.
To Pack/Tar the file or directory:
Syntax: tar -cvzf <target_file_name> <source_file_Or_Directory_Name>
e.g.: tar -cvzf jdk1.8_241.tar.gz jdk1.8_241
How to unpack .zip file:
Unzipping in the same directory where the zip file is:
Syntax: unzip <Source_Zip_File>
e.g: unzip music.zip
Unzipping the file to a particular directory:
Syntax: unzip <source<zip_file> -d <target_directory_to_unzip>
e.g: unzip music.zip -d \home\music
How to pack .zip file:
zipping the directory:
Syntax: zip -r <target_zip_file_name> <Source_Directory>
e.g: zip -r music.zip /home/music
Zipping a file
zip names.zip names.txt
How to Unpack .zip file:
Unzipping the file to a particular directory:
Syntax: unzip <source<zip_file> -d <target_directory_to_unzip>
e.g: unzip music.zip -d /home/music
To unzip within the same directory, use the without -d
unzip music.zip
You can encrypt .zip with a password by passing the -e option:
zip -r -e music.zip /home/music
Verify file with the ls command:
ls -l music.zip
This is the meaning for each letter in -xvzf or cvzf
- -x: Extract, retrieve the files from the tar file.
- -v: Verbose, list the files as they are being extracted.
- -c: Create, Create a tar or zip file
- -z: Zip, use gzip, zip or tar.gz to decompress the tar file.
- -f: File, the name of the tar file we want
tar
to work with.
Cheers!
Bose
No comments:
Post a Comment