Linux Zip Command with ExamplesZip is a file packaging and compression utility for Unix. All the files are stored inside a single file, i.e., .zip {.zip-filename} along with the .zip extension.
Syntax:Syntax to create any zip file:Extract files from a zip fileUnzip can extract, test, or list files from the ZIP archive which is commonly detected on Unix. The default nature is for extracting into the current directory each file through the particular ZIP archive. Syntax:Options in Zip Command:1. -d Option: This option removes any file through the zip archive. We can remove any file through the archive with the help of the -d option after making a zip file. Syntax: 2. -u Option: This option can update the file inside the zip archive. It could be used for updating the described list of files or adding new files to an existing zip file. We can update the existing entry inside the zip archive if only it has been changed more recently as compared to the version that already existed within the zip archive. Syntax: 3. -m Option: After zipping, this option deletes the real files. Transfer the particular files into a zip archive as it deletes the target files/directories after creating the specified zip archive. In case, if the directory becomes unoccupied after the removal of the file, the directory is also removed. Until zip has made the archive without any error, no deletion is done. It is useful to conserve disk space; however, it is potentially unsafe to remove every input file. Syntax: 4. -r Option: To recursively zip a directory, use the zip command with this -r option and it will zip specified files inside the directory recursively. This option supports us to zip every file that existed inside the specified directory. Syntax: 5. -x Option: This option can exclude the specified files in making the zip. For example, we are zipping every file in the directory and wish to exclude a few unwanted files. We can exclude the unwanted files with the help of this option. Syntax: 6. -v Option: Print diagnostic or verbose mode version info. It enables a progress indicator display during requests verbose diagnostic and compression info about oddities of zip file structure when normally e applied to the original operations. The diagnostic screen will be e printed if -v is the single command-line argument, and either stdout or stdin are not redirected to any file. In extension to the help screen header along with release date, version, and program name, a few pointers to the distribution sites and Info-ZIP home are given. It then displays information about the destination environment (compiler version and type, compilation date, OS version, and the enabled options aspects used for creating a zip executable. Syntax:
Next TopicCPU Utilization in Linux
|