![]() I think this is always good practice, especially when you’re logged in as the root user. I almost always list the contents of an unknown archive before I extract the contents. That same command can also work on a file that was tar’d and gzip’d in two separate steps (as indicated by the. To list all the files in a compressed archive, add the z flag like before: This lists all the files in the archive, but does not extract them. To list the contents of an uncompressed tar archive, just replace the c flag with the t flag, like this: ![]() The general syntax of the tar command when creating an archive looks like this: ![]() The v flag is completely optional, but I usually use it so I can see the progress of the command. The letter f tells tar that the name of the archive appears next (right after these options).The letter v means “verbose,” which tells tar to print all the filenames as they are added to the archive.In that command, I used three options to create the tar archive: It's common to name an uncompressed archive with the. Where is the name of the archive (file) you are creating, and MyProject is the name of your subdirectory. For instance, assuming there is a subdirectory named MyProject in the current directory, you can use tar to create an uncompressed archive of that directory with this command: 1) Create a tar archive of a subdirectoryĪ common use of the tar command is to create an archive of a subdirectory. One user may archive a large collection of files, and another user may extract those files, with both of them using the tar command. These days the Linux tar command is more often used to create compressed archives that can easily be moved around, from disk to disk, or computer to computer. Where we now use the Linux tar command to create a tar file, we used to tell it to write the tar archive to a device file (in /dev). The name “tar” stands for “tape archive.” As that name implies, in the old days it was a command that Unix administrators used to deal with tape drives. But first, a brief bit of background information. I’m a big believer in learning Unix/Linux commands by seeing examples, and I know from experience it will really help to see some Linux tar command examples. Unix/Linux tar command FAQ: Can you share some Linux tar command examples?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |