3

I want to compress the contents of:

/ebs1/xxx/aaa/bbb/

So, all the files and folders inside "bbb" I want to be compressed to a file named "xxx.tar.gz" I am using:

tar -zcvf "xxx.tar.gz" "/ebs1/xxx/aaa/bbb/"

It's ok. But when I open the file "xxx.tar.gz" the tree directories start at

/ebs1 -> /xxx -> /aaa -> /bbb ->

and after this I can see the content.

Is it possible to tell tar not to include the parent directories in the compressed files, so when I extract it I dont need to open all directories to get to my content?

Rahil Wazir
  • 10,007
  • 11
  • 42
  • 64
amandanovaes
  • 694
  • 2
  • 7
  • 20

1 Answers1

11

Try this:

tar -czvf xxx.tar.gz -C /ebs1/xxx/aaa/bbb .
Matt K
  • 6,620
  • 3
  • 38
  • 60