
To use tar and gzip to combine all the files in a directory into a compressed archive file (for example, my_), use the following command (replace /path/to/my/directory with the absolute path to the directory containing the files you want to combine):.To use tar and gzip to combine multiple files into a compressed archive file (for example, my_), use the following command (replace file1 and file2 with the names of the files you want to combine):.If your system uses GNU tar, you can use tar in conjunction with the gzip file compression utility to combine multiple files into a compressed archive file. Many Linux distributions use GNU tar, a version of tar produced by the Free Software Foundation. The -v option tells tar to be verbose (report all files as they are added).If you don't use the -f option, tar will assume you want to create a tape archive instead of combining a number of files.You can use any name in place of my_files.tar, but you should keep the.If you want to zip folders in the current working directory, you would run the following command $ find. You have to link it to the “exec” option in order to execute the “zip” command that creates an archive. zipĪlternatively, if you are not sure where you stored your zip files before, you can search for files using the find command $ find / -name *.zip 2> /dev/null Zip Folder using findĪnother great way of creating a zip file for your folders is to use the “find” command on Linux.

In order to check if your zip file was created, you can run the “ls” command and look for your archive file. In order to achieve that, you would run the following command $ zip -r temp.zip Documents įor example, let’s say that you want to archive a folder named “Documents” in a zip file named “temp.zip”. You can also specify multiple folders if you want to have multiple directories compressed in your zip file. The easiest way to zip a folder on Linux is to use the “zip” command with the “-r” option and specify the file of your archive as well as the folders to be added to your zip file.
