Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a tar file and I need to extract a single file from it and put it to another directory.

I tried this but it gives an error message. It did extract the file but not to the directory that I want but it extracted the file to the same directory.

tar xvf tarfile.tar -C /home/myDir filename_tobe_extracted

The error is:

x filename_tobe_extracted, 4046 bytes, 8 media blocks.
File -C not present in the archive.
File /home/myDir not present in the archive.


share|improve this question

Your command works as expected in my tests, both in GNU tar (1.26) and BSD tar (2.6.2).

The format of your output suggests you're using a different version from either of those. Adding the output of tar --version to your question may be helpful. In any case, your version of tar seems to be having problems parsing the command arguments, so I recommend splitting them up and flipping them around. Maybe try:

tar -x -v -C /home/myDir -f tarfile.tar filename_tobe_extracted
share|improve this answer

Your Answer


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.