
Often, you will be tasked with zipping directories since they take up more space for the most time. If you prefer you get rid of them during archival and conserve space, invoke the -m option during archival as shown: $ zip -m reports.zip reports1.txt reports2.txt reports3.txt For instance, to remove reports4.txt from the zipped file, run: $ zip -d reports.zip reports4.txt Example 6) Delete files after zipping (-m)Īs you may have noted, the original files remain even after zipping or archiving them.

To remove a file from an archive, invoke the -d flag.

$ zip home.zip *Įxample 5) Delete a file from an archive (-d) Be sure that you are working in the home directory. If you have multiple files in your current directory, you can zip all of them at a go using the wildcard symbol as shown in the syntax below:įor example, to compress all files in the home directory to home.zip archive, execute the command below. To view contents of a zipped file, use the command as shown: $ zipinfo archive.zipĮxample 4) Zipping all the files in the current directory (* ) For example, to add another file reports4.txt, run: $ zip -u reports.zip report4.txtĮxample 3) View contents of a zipped file To zip them into the archive reports.zip, run the command: $ zip reports.zip reports1.txt reports2.txt reports3.txtĮxample 2) Adding a file to a zip archive (-u)Īt times, you may find the need to add a file to a zip archive. The command for this operation will be: $ zip reports.zip reports1.txtĪdditionally, you can zip multiple files at a go into an archive as shown:Īgain, let’s assume that we have 3 text files reports1.txt, reports2.txt and reports3.txt. Let’s assume you have a text file – reports1.txt – in your current directory and you want to zip it into an archive called reports.zip.
MAC ZIP COMMAND LINE PASSWORD HOW TO
Let’s dive in and see how to zip and unzip files and directories in Linux with zip and unzip command with examples.
MAC ZIP COMMAND LINE PASSWORD INSTALL
Open the terminal and execute the beneath command, $ sudo yum install -y zip unzip

$ sudo apt-get install -y zip unzip Install zip & unzip command on CentOS / RHEL / Fedora
