![]() ![]() ![]() The compressed files inside will go to your current directory in no particular order. Just enter unzip then the file name of the archive file. The zip and unzip commands are default to the Raspberry Pi OS, so no need to install them explicitly. To uncompress a zip file, simply write the command below. Extracting Zip FilesĮxtracting a file means getting the original files out of a compressed file format. Zipped files are very popular and most people today know what a zipped file is. One of the earliest compressed file formats is the zip format. So in this article we will just focus on how to compress and extract zip and tar files. There are more than a dozen compressed file formats – zip, tar, rar, 7z, arc, arj, cab, and many more. Also, for rated internet services, a reduced file size means saving money. ![]() With a smaller file size, data storage is relieved. Hosting a website, especially for DIY projects using an Arduino or a Raspberry Pi, is often limited in memory space. Having a smaller file is advantageous when dealing with the internet. This means the top-level directory that is containing the archive files will not be created instead the files will be placed directly in the “ new_name” directory during the extracting process.File compression is putting one or more files in an archive so that their cumulative size is reduced. ![]() “ –strip-components 1“: Another option we have used is to ask the Tar to remove the first directory component from the file names in the archive. All the extracted files will be placed in the “ new_name” directory, so, change it with whatever name you want to use for your extracted directory. “ –one-top-level= new_name“: This option is used to tell the Tar which directory it must be used to extract the files into, and if it doesn’t exist, it will create the one automatically. In simple words, it will rename the main archive folder name to what you have set and then extract all the files of the archive in it. It will extract the content in a new directory named “ new_name” while stripping the top-level directory from the extracted files. The above command follows the same regular process for extracting the files in the directory where your Archive is present, however with a slight alteration. tar -xzvf -one-top-level= new_name -strip-components 1 Those who want to extract the Tar file content in the same directory with some different folder name can use the given command. Extract Tar in the same directory but with renamed folder: In the given screenshot you can see we didn’t have any folder named “ testfolder” under “/ opt” so the extraction command gave the error for the same. Which can also be replaced with the –directory option. The “-C” option in the command is used to specify the directory to extract the files.The “-f” specifies the name of the archive file to extract.The “-v” enables verbose output so that you can see what is happening during the extraction,.The “-z” option decompresses the archive (since it is in gzip format).The “-x” option extracts the contents of the archive.Let’s say we have a directory named – TestFolder inside /opt and want to extract the archive file in it, the command to do that will be like this: sudo tar -xzvf -C /opt/testfolder Replace /path/to/myfolder with the exact folder where you want to extract the content. So, the Tar command to extract the files in some different folder is: tar -xzvf -C /path/to/myfolder And if not then create it using: mkdir folder-name However, first, make sure the folder in which you want to extract the Archive file exists. When untarring a compressed archive file, you can specify the directory name to use for the extracted files by using the “ -C” or “ –directory” option followed by the directory path.įor example, let’s suppose you already have an Archive file named – “ ” and you want to extract it into a folder, let’s say “ Testfolder“, you can do that using the -C option. Extract Tar in the same directory but with renamed folder: Command to extract a Tar archive in some particular folder Extract TAR into some existing folder: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |