I'm installing some of my data from my old server to my new server.
Since I had my old server for ages, I have a huge amount of legacy data with, most certainly, legacy user and group names.
When extracting, tar does its best to match the user and group info by name and uses the identifiers as a fallback or the current user as a last resort.
What I'd like to do is make sure that all the users and groups exist before I do the extraction. That way all the files get the correct ids.
To do that, the best way I can think of is to list all the user and group names found in the tar file. I know I can use the
tar tvf backup.tar command to list all the files, but then I'd have to come up with a way to extract the right two names.
I'm wondering whether there would be a simpler way than using the
tv option. Some tool or command line options that only extracts the user name and group name, the I can use
sort -u to reduce the list to unique entries.
Anyone knows of such a feature?