Difference between revisions of "How to transfer files from one Linux system to another"
[unchecked revision] | [unchecked revision] |
(Created page with "This is a short tutorial for copying from any Linux/Unix system to another. <span class="script">page.toc</span> ====Using tar==== Example:you have some files you want to c...") |
|||
(3 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
This is a short tutorial for copying from any Linux/Unix system to another. | This is a short tutorial for copying from any Linux/Unix system to another. | ||
− | + | ==Using tar== | |
− | + | ||
− | + | ||
Example:you have some files you want to copy/transfer from your own Linux system onto a server. | Example:you have some files you want to copy/transfer from your own Linux system onto a server. | ||
Line 14: | Line 12: | ||
cp file1.c file2.c project2010 | cp file1.c file2.c project2010 | ||
− | + | tar cf project2010.tar project2010 | |
− | tar cf | + | |
When this has finished, do: | When this has finished, do: | ||
− | |||
scp project2010.tar xyz@thinlinc.imm.dtu.dk:/home/xyz/project2010.tar | scp project2010.tar xyz@thinlinc.imm.dtu.dk:/home/xyz/project2010.tar | ||
Now logon to thinlinc.imm.dtu.dk and do: | Now logon to thinlinc.imm.dtu.dk and do: | ||
− | + | tar xpf project201.tar | |
− | + | ||
− | tar xpf | + | |
When this has finished then do: | When this has finished then do: | ||
− | |||
rm project2010.tar | rm project2010.tar | ||
− | + | ==Using tar over ssh== | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
You can pipe the output of the tar command directly to ssh, and thus avoid the storing of the temporary .tar file. Place your files in the directory as above, then run the following: | You can pipe the output of the tar command directly to ssh, and thus avoid the storing of the temporary .tar file. Place your files in the directory as above, then run the following: | ||
Line 45: | Line 34: | ||
This will tar the local directory "project2010" and untar it on thinlinc into a directory project2010 in your home. | This will tar the local directory "project2010" and untar it on thinlinc into a directory project2010 in your home. | ||
− | + | ==Using rsync== | |
The following command will copy the local directory "project2010" to your home directory on thinlinc. | The following command will copy the local directory "project2010" to your home directory on thinlinc. | ||
Line 53: | Line 42: | ||
If you want to place it in a different directory on thinlinc then just add that directory name after the : in the above command. | If you want to place it in a different directory on thinlinc then just add that directory name after the : in the above command. | ||
− | + | As with any file copy please ensure that you do not accidently overwrite any files on thinlinc. | |
− | + | ||
− | + | [[Category:Misc]] | |
− | [[Category: | + |
Latest revision as of 13:44, 14 June 2012
This is a short tutorial for copying from any Linux/Unix system to another.
Using tar
Example:you have some files you want to copy/transfer from your own Linux system onto a server.
Create a new directory:
mkdir project2010
copy the files you want to transfer into that directory/folder:
cp file1.c file2.c project2010 tar cf project2010.tar project2010
When this has finished, do:
scp project2010.tar xyz@thinlinc.imm.dtu.dk:/home/xyz/project2010.tar
Now logon to thinlinc.imm.dtu.dk and do:
tar xpf project201.tar
When this has finished then do:
rm project2010.tar
Using tar over ssh
You can pipe the output of the tar command directly to ssh, and thus avoid the storing of the temporary .tar file. Place your files in the directory as above, then run the following:
tar -cf - project2010 | ssh USERID@thinlinc.imm.dtu.dk tar -xf -
This will tar the local directory "project2010" and untar it on thinlinc into a directory project2010 in your home.
Using rsync
The following command will copy the local directory "project2010" to your home directory on thinlinc.
rsync -av project2010 --rsync-path=/opt/csw/bin/rsync USERID@thinlinc.imm.dtu.dk:
If you want to place it in a different directory on thinlinc then just add that directory name after the : in the above command.
As with any file copy please ensure that you do not accidently overwrite any files on thinlinc.