Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Example command:
$ tar -cvjf destination.tar.bz2 /path/to/folder/source

I'd like the final destination.tar.bz2, when extracted, to not include a /path/to/folder/ file directory. It seems inefficient to extract the tarball and then mv the contents of /path/to/folder/source to a different directory.

share|improve this question
up vote 11 down vote accepted

tar -C /path/to/folder -cvjf /path/for/acrhive.tar.bz2 source

-C (uppercase) means 'change directory', so your file specification becomes relative to the path provided with -C

share|improve this answer

There are many ways to accomplish that, but this is probably the simplest:

cd /path/to/folder
tar -cvjf /past/to/destination.tar.bz2 source
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.