How to Zip a Folder in Linux

Lot of people get confused and don’t know this simple command. Most of the webmaster uses ftp programs like filezilla or cuteftp or winscp and are not very comfortable with shell but sometimes for taking backups, it becomes very important to use zip to get backup of all files and folders.

If you are looking to zip a folder (with subfolders and many files in it), this is the command for it -

zip -9 -r <zip_file_name.zip> <folder_name>

To zip a single file, you can use this command

zip -9 -r <zip_file_name.zip> <file_name>

The -9 option is for better compression.

there are many variants of zip command like bzip and gunzip but I think zip is fine enough. though I think bzip gives little better compression. If you get an error like command not found then your system may not support zip (which is certainly shocking!) though in that case you can use tar command.

tar -cvzf <tar_file_name.tar> <file_name>

to untar the file, you need to use

tar -xvzf <tar_file_name.tar>
GD Star Rating
loading...
GD Star Rating
loading...

Related Articles

Random Articles

Post a Comment