


What if you want to zip several files and folders at the same time in a single archive at the same time? Linux zip command to recursively compress files and folders Ignore the trailing slashes after the folder1 or folder2 and so on, they're added automatically due to bash shell tab auto complete. zip -r folder_backup.zip folder1/ folder2/ folder3/ Now, if you want to add multiple directories to that zip archive, this should be like below. Of course you've to use the -r flag with zip command to recursively compress files. Here we'll learn how to add single or multiple folders to a zip archive, not much different from files anyway.Īs example, in linux you can zip folder with command line like below. zip -9r /root/log_backup/logs_25082017.zip /var/log/ Linux zip folder with command line If you need to create the ZIP archive somewhere else, I mean not in the current director(pwd), just append the proper path before the archive name. Well, the files used in the above example are pretty random, and backup.zip is our archive. zip backup.zip border.png db_backup_wp2.sql my_resume.pdf pp.jpg

If you want to compress multiple files with zip command at once, it's like the example command below. zip database_backup.zip db_backup_wp2.sql Now we'll learn how to zip and single and multiple files with the linux zip command.Ī practical example for a single file could be like below, assume you want to compress the file db_backup_wp2.sql with zip. Typical syntax to create a zip file is like this, zip output_file.zip input_fileĮxplanation, here input_file is the file we want to compress, and output_file.zip is our zip archive output.Įnjoy free shipping and One-Day delivery, cancel any time.
