connectorhasem.blogg.se

Linux zip folder command line
Linux zip folder command line











linux zip folder command line

We will use the same example as with the gzip method and compress an SQL file. Upon reaching your desired file, please type in the following command: zip. The difference between the two is pretty minor, so their usage is up to personal preference. You can use it for single files, multiple files, and directories, and it is similar in functionality to the tar.gz command-line utility. The last command we will be going over is the zip command. Another significant difference between the tar and the gzip command.

#Linux zip folder command line archive#

The above action will remove the compression, restore the original folder, however, the archive will remain. Same example with public_html: tar -zxf public_html

  • x - Stands for “extract ”, which tells “tar ” to remove the compression.
  • To remove the compression and extract the files from the archive, please use the command: tar -zxf When the process is over, you will see a compressed copy of the public_html folder, unlike the gzip process, which replaces the original file. Here is an example of us compression the root directory of a website: tar -zcf public_ public_html
  • v(optional) - You can add this flag so that the command will output the compression process.
  • f - Using this option uses the archive file or device ARCHIVE.
  • c - The “c ” flag stands for “create ” and tells tar to create the archive.
  • linux zip folder command line

    z - This flag will filter the command through gzip.Upon reaching your desired file or folder, please type in the following command: tar -zcf. This compression method is excellent for archiving entire directories where you need to keep the file structure the same (website directories, for example) and multiple files that you want to compress together. It keeps the original names of the inodes, the directory structure, file/folder permissions, and ownerships along with any relevant information about the file. The tar/tar.gz method is suited for compression on files, folders, and multiple files/folders simultaneously. This action will leave you with the original file without any form of compression.

    linux zip folder command line

    We will use the same example as above: gunzip nossl_ To remove the compression and get the original file back, type the following command: gunzip. It is not lost - the newly compressed version simply replaces it. gz extension at the end, in our case, nossl_ ). Note that the file you are archiving will disappear, and you will find the archive in its place(it will have the name of the original file, with a. The result is a new file, which has almost five times the reduced size. Here is an example of compressing an SQL file via the command line: gzip nossl_wp18.sql Upon reaching your desired file or folder, please type in the following command: gzip After login inside, you can use the Linux Command Line basics to navigate and locate the file or folder you wish to compress. It is handy for text files, SQL files, or archived files via a different compression type ( zip, tar, tar.gz )īefore using any Linux commands, you need to log inside your account using the SSH protocol. The gzip method of compression is only usable on single files. This knowledgebase article will go over the commands you can use to archive or compress files/folders in a Linux environment through the command-line interface. You may have heard or used compression methods before, especially if you are using ( Windows) WinRAR or tar and gzip ( Unix), and zip which usually is cross-platform compatible. It uses encoding technology, and the purpose is to reduce the targeted inode’s bit structure and prep it for faster transfer or simply bring down its disk space utilization. Data compression, or sometimes referred to as archiving, is a service that helps you lower the original size of a folder or a file, ultimately reducing its disk space usage.













    Linux zip folder command line