1

I have a tar archive and want to see the content with the group-ids and user-ids. When using

tar --list -v --file file.tar

I see the user and group names, but I want to see the user-ids and group-ids instead. How can I achieve this? Or are the users itself stored in a tar archive, and not the ID?s?

2

When you create a tar archive, the tar utility store the User ID. When you show the content, it looks for the user in /etc/passwd, if it is found print the username, if not print the ID.

To avoid this behaviour try with the --numeric-owner option.

0

Use --to-command option:

tar xf file.tar --to-command 'echo $TAR_FILENAME:$TAR_UID:$TAR_GID'

To see user and group names, rather than uid/gid:

tar xf file.tar --to-command 'echo $TAR_FILENAME:$TAR_UNAME:$TAR_GNAME'

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.