Linux zip command
Linux Command大全
The Linux zip command is used to compress files.
zip is a widely used compression program, and the file extension of the compressed file is .zip.
Syntax
zip [-AcdDfFghjJKlLmoqrSTuvVwXyz$][-b <working directory>][-ll][-n <trailing string>][-t <date time>][-<compression efficiency>][compressed file][file...][-i <template style>][-x <template style>]
Parameters:
- -A Adjust the executable automatic decompression file.
- -b<working directory> Specify the directory where the files will be temporarily stored.
- -c Add comments to each compressed file.
- -d Delete the specified file from the compressed file.
- -D Do not create directory names within the compressed file.
- -f Update the existing files.
- -F Try to repair the damaged compressed file.
- -g Attach the compressed file to the existing compressed file after compressing the file, rather than creating a new compressed file.
- -h Online help.
- -i<template style> Only compress files that meet the conditions.
- -j Only save the file name and its content, without storing any directory names.
- -J Delete unnecessary data before the compressed file.
- -k Use MS-DOS compatible file names.
- -l When compressing files, replace LF characters with LF+CR characters.
- -ll When compressing files, replace LF+CR characters are replaced with LF characters.
- -L Display copyright information.
- -m After compressing the file and adding it to the compressed file, delete the original file, that is, move the file to the compressed file.
- -Do not compress files with specific trailing strings.
- -o Set the modification time of the compressed file to the same as the file with the latest modification time inside the compressed file.
- -q Do not display the execution process of the command.
- -r Recursive processing, process all files and subdirectories in the specified directory.
- -S Include system and hidden files.
- -t<date time> Set the date of the compressed file to the specified date.
- -T Check whether each file in the backup file is correct and error-free.
- -u With -f Parameters are similar, but in addition to updating existing files, it will also decompress other files in the compressed file to the directory.
- -v Display the execution process of the command or display version information.
- -V Save file attributes of VMS operating systems.
- -w Add version numbers to file names, this parameter is only valid in VMS operating systems.
- -x<template style> Exclude files that meet the conditions during compression.
- -X Do not save additional file attributes.
- -y Save symbolic links directly, rather than the file pointed to by the link, this parameter is only valid in systems like UNIX.
- -z Add comments to the compressed file.
- -$ Save the volume name of the disk where the first compressed file is located.
- -<Compression Efficiency> Compression efficiency is a value between1-9of the value.
Online Examples
To /home/html/ All files and folders in this directory will be packaged into html.zip in the current directory:
zip -q -r html.zip /home/html
If we are in /home/The following commands can be executed in the html directory:
zip -q -r html.zip *
Delete file a.c from the compressed file cp.zip
zip -dv cp.zip a.c
Linux Command大全