• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 924
  • Last Modified:

tar -zxvf syslinux-3.86.tar.gz

what is purpose of tar, and what are alternatives

tar -zxvf syslinux-3.86.tar.gz

what will above command do ?
1 Solution
The above command will make the /usr/src/redhat/SPECS directory, creating any directories required (e.g. if /usr/src exists but /usr/src/redhat doesn't, it will create /usr/src/redhat then create /usr/src/redhat/SPECS)

The flag is -p, not -P.

With "-p" there is no error if the directory already exists (without "-p", mkdir will print an error message if the directory already exists).
tar is an archiving utility which stores files from a tape or disk archive

-z to unzip the .gz extension files
-x to extract files from an archive
-v to verbosely list files processed
-f use an archive file

tar is like a winzip in windows.
Oops, wrong question!

As for the above question, 2tar" is an archiver - it collects multiple files within one archive file, so that the single file can be backed up, or copied to anoter machine.  Later on, individual files within the archive, or the entire archive, can be extract to the same place on the same machine, in a different place on the same machine, or on a different machine.

Alternatives are cpio and zip.  cpio is more efficient at saving small files than tar, and allows more flexibilty in selecting the list of files to be archived.  zip is portable (to a certain extent) between UNIX and Windows.

As for the above command, it will extract all files from the syslinux-3.86.tar.gz archive file, using the same directory structure as when the archive was created.  The "z" flag tells tar that the archive is compressed with gzip (it would be "j" for archives compressed with bzip2).  "x" tells it to extract the files (as opposed to "c" when creating archives, or "t" when checking the validity of an archive file). "v" tells tar to list out the names of files as it extracts them.  "f" tells tar that the folowing word on the command line is the name of the archive to be processed.
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

"man tar" would be the great help.
aasheeAuthor Commented:
thanks a lot for u guys.

how can we find out that archive was compressed with bizp2 and to use j option not the z ?
You might be able to tell from the filename - if it ends .tar.bz2, then it was probably bzip2, but there is no guarantee.  The person creating the file can call it whatever they want!

Your best bet is
file syslinux-3.86.tar.gz

Open in new window

this might return:
syslinux.tar.bz2: bzip2 compressed data, block size = 900k
syslinux.tar.tgz: gzip compressed data
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now