1.zip Command
zip-r myfile.zip./*
All files and folders under the current directory are compressed into myfile.zip files, and-R indicates that all files in the subdirectory are compressed recursively.
2.unzip Command
unzip-o-d/home/sunny myfile.zip
Unzip the Myfile.zip file to/home/sunny/
-o: Overwrite the file without prompting;
-d:-d/home/sunny indicates that the file is extracted to the/home/sunny directory;
3. Other
zip-d myfile.zip smart.txt
To Delete a smart.txt file in a compressed file
zip-m myfile.zip./rpm_info.txt
to add a rpm_info.txt file to a myfile.zip in a compressed file
-------------------------------------------------------------------------------
to compress a file using Zip, type the following command at the shell prompt:
zip-r filename.zip Filesdir
in this example, Filename.zip represents the file you created, and Filesdir represents the directory where you want to place the new zip file. The-r option specifies that you want to recursively (recursively) include all files included in the Filesdir directory.
to extract the contents of a zip file, type the following command:
Unzip Filename.zip
You can use the zip command to work with multiple files and directories at the same time by listing them one after the other with a space interval:
Zip-r filename.zip file1 file2 file3/usr/work/school
The above command compresses the contents of the File1, File2, File3, and/usr/work/school directories (assuming this directory exists) and then puts them in the Filename.zip file.
Linux basic commands