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! :)


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

|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).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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