1

I created an Ubuntu minimal installation on a VirtualBox VM. Then, I decided to archive it so that I could share it with friends. I am letting them use it so that they can experiment with Linux commands.

I archived it using the command,

tar -zcvf ./Hackcraft.tar.gz ./Hackcraft

The archive process worked great. However, when I opened the archive in FileRoller, I noticed that the first visible directory is "." without quotes. When I double-clicked on that directory to look inside it, I saw my Hackcraft folder, which was archived. In it was all of my files.

The question is, why is the top-level folder .? I know that it is used, for example, when cd'ing in a terminal, to denote the current folder. But why is it there?

2

The command you've given creates a tarball with paths starting with ./Hackcraft; you can see that by running

tar tf Hackcraft.tar.gz

File Roller presents the contents of the tarball folder by folder, splitting on /, which results in its showing a root folder named ., containing a folder named Hackcraft.

(The tarball itself doesn't contain a . entry.)

  • That would make sense. Thanks for the answer! – Computer Looker Dec 30 '16 at 22:25
0

When a tar archive has an entry for ./, it is used to record the ownership and permissions of the current directory. Thus, when you unpack it, the ownership and permissions of the current directory might change.

That being said, the command you gave should not result in a tar archive with a ./ member. It is possible that FileRoller is implicitly stripping off the top level directory.

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.