Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am given the following command:

tar -x -v -f /dev/rct0 -b 20 *

Could someone please explain its meaning, because in this form it looks completely useless to me. As far as I know -x stands for extract. So, take all files (?) from the current dir and extract them to the type drive rct0? If so, what is the -b 20 flag doing there? (use the maximum size block size when writing?) I would have tried it myself, unfortunately I don't have a tape drive. I hope someone will shed some light on what is going on here. Happy holidays everyone! :)

share|improve this question

2 Answers 2

up vote 4 down vote accepted

From tar --help:

  • -x tells tar to extract files.

  • -v makes it verbose.

  • -f /dev/rct0 specifies the file to extract from.

  • -b 20 specifies the blocking factor. (obsolete, since 20 is the default)

  • Finally, * instructs tar to extract all files that are present in the current directory.

A shorter command to achieve the same action would be:

tar xvf /dev/rct0 *

Regarding the blocking factor:

The data in an archive is grouped into blocks, which are 512 bytes. Blocks are read and written in whole number multiples called records. The number of blocks in a record (i.e., the size of a record in units of 512 bytes) is called the blocking factor. The --blocking-factor=512-size (-b 512-size) option specifies the blocking factor of an archive. The default blocking factor is typically 20 (i.e., 10240 bytes), but can be specified at installation. To find out the blocking factor of an existing archive, use tar --list --file=archive-name. This may not work on some devices.

Source: The Blocking Factor of an Archive

share|improve this answer

From tar manpage:

 -x, --extract, --get
       extract files from an archive
 -b, --blocking-factor BLOCKS
       BLOCKS x 512 bytes per record
 -f, --file ARCHIVE
       use archive file or device ARCHIVE
 -v, --verbose
       verbosely list files processed

So this command reads data from tapedrive (-f /dev/rct0), interprets it as tar-archive and extracts (-x) all files which are already present in current directory (*). Blocking factor is most likely adjusted to optimize tapedrive performance (haven't worked with them either).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.