What is the command(s) to uncompress tar archive?!?

0 views
Skip to first unread message

Peter Williams

unread,
Oct 7, 2008, 1:36:29 AM10/7/08
to ubun...@lists.ubuntu.com
Hi All,

I have a tar archive "user_backup_20080918.tgz" -- which is 19.4 GB of data which was previously my home folder, with many sub-folders, for my (old) user name 'user'.

I have since reinstalled Linux... actually a new installation of Linux Ubuntu Mint. Now I want to uncompress the archive to my new home folder with my new user name of 'peter'.... what are the commands I need to do to achieve this?!?

note that the archive contains:

user_backup_20080918.tgz (19.4 GB filesize)
 + user (folder)
     + many folder and sub-folders here, as well as hidden files with leading dots in their filenames.

eg. would need to uncompress folders inside 'user' folder (old user name) to current 'peter' user (home) folder.

I'm guessing that I'd need to use the chown (change owner) command -- but I don't know how it works... I think I'd need to run it recursively on sub-folders... correct?!? How do I do this?

Regards,
       PEW  ;-)))

--
Fond Regards,
Peter Eric (aka 'pew') WILLIAMS
from Hobart, Tasmania, Australia -- phone (03) 6236-9675

My free website is: http://pewtas.googlepages.com  (or) http://tinyurl.com/yuyejs

(please visit my free website and let me know what you think about it.)

Owen Townend

unread,
Oct 7, 2008, 2:00:56 AM10/7/08
to ubun...@lists.ubuntu.com
2008/10/7 Peter Williams <pew...@gmail.com>:

> Hi All,
>
> I have a tar archive "user_backup_20080918.tgz" -- which is 19.4 GB of data
> which was previously my home folder, with many sub-folders, for my (old)
> user name 'user'.
>
> I have since reinstalled Linux... actually a new installation of Linux
> Ubuntu Mint. Now I want to uncompress the archive to my new home folder with
> my new user name of 'peter'.... what are the commands I need to do to
> achieve this?!?
>
> note that the archive contains:
>
> user_backup_20080918.tgz (19.4 GB filesize)
> + user (folder)
> + many folder and sub-folders here, as well as hidden files with
> leading dots in their filenames.
>
> eg. would need to uncompress folders inside 'user' folder (old user name) to
> current 'peter' user (home) folder.
>
> I'm guessing that I'd need to use the chown (change owner) command -- but I
> don't know how it works... I think I'd need to run it recursively on
> sub-folders... correct?!? How do I do this?
>
> Regards,
> PEW ;-)))
>

Hey,

tar will change the owner of the files as they are extracted to be
owned by the current user.
(Except root, where the default is to preserve the owner)
So all you need then is read the man page...
or:
decompress (-z)
extract (-x)
strip off the top directory 'user' (--strip 1)
output to your current home directory (-C /home/peter)
specify the archive (-f /path/to/user_backup_20080918.tgz)

Combined:
tar -zx --strip 1 -f user_backup_20080918.tgz -C /home/peter

cheers,
Owen.

--
ubuntu-au mailing list
ubun...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-au

Reply all
Reply to author
Forward
0 new messages