Unless there is something magically different about the new Linux setup versus the old Linux setup, then doing a straight copy would be best. My approach would be like this. First, on the old machine create a .tar.gz
archive of the existing user home directory like this; first cd
to the parent /home/
directory:
cd /home/
Next, create the .tar
archive like this; note the appended _old
to the filename:
tar -cf username_old.tar username
Now GZip it like this:
sudo gzip username_old.tar
And that will leave you with an archive named username_old.tar.gz
.
Now if these are two different machines, make sure to create the new user on the new machine. And then on the old machine use a copying tool like scp
(secure copy) to copy it to the new machine:
scp /home/username_old.tar.gz username@new_machine:.
You might have to enter your name and password, but that will copy it from the old machine to the new one.
Now login to your new machine and the file username_old.tar.gz
should be in your user’s home directory. Move it one directory up to the /home/
parent like this:
sudo mv ~/username_old.tar.gz /home/
With that done, wow to recover that data is your choice, but I would recommend doing the following. On the new machine do a variant of what you did on the old machine to create a backup of the existing ~/username
directory on the new machine:
cd /home/
tar -cf username_new.tar username
sudo gzip username_new.tar
And that will create a nice backup copy of the ~/username/
directory named username_new.tar.gz
; better be safe than sorry.
Okay, final step is to unarchive username_old.tar.gz
like this:
cd /home/
sudo tar -xf username_old.tar.gz
This final step will unarchive the contents of username_old.tar.gz
into the ~/username/
directory on the new machine. It won’t overwrite the directly completely, but basically overwrite items that exist there and add new items if they don’t; it’s like a merge of content.
Another approach would be for you to just leave username_old.tar.gz
in your home directory on the new machine, unarchive it in that directory and then pick/choose items to copy from it when you need it.
This really all depends on the depth of content your user directory has and how you personally would like to deal with stuff like this. But generally, creating .tar.gz
archive of the old content and copying it to the new machine is the best way to go.
I would up vote you all but I do not have enough reputation, sorry! +1 to all – Christopher Smith – 2015-02-04T02:36:38.557