Copying files to/from remote PC in the CLI
Posted: 13 Oct 2012, 11:46
We all know the lovly SSH where we can log in to remote PC's and if you can do it via Dolphin or Nautilus we can drag and drop files between them, But believe me; sometimes that does not work!
So you are stuck in your CLI and want to copy files to and from your remote box to finish that all important project in Greenland or on the Bouvet islands.
What to do?
Enter SSH's brother secure copying; scp - if you have set up SSH with keys and pasword-less login it will work with scp too.
So here we go: to copy from a remote box:
This will copy document.txt from your remote berserfiles directory to your local berserkfiles directory.
To copy entire directories you can use the -r switch like this:
This will copy the berserkfiles directory to ~/
To copy to a remote box:
If you are using other ports than 22 you will need to specify the port:
Usefull stuff!
So you are stuck in your CLI and want to copy files to and from your remote box to finish that all important project in Greenland or on the Bouvet islands.
What to do?
Enter SSH's brother secure copying; scp - if you have set up SSH with keys and pasword-less login it will work with scp too.
So here we go: to copy from a remote box:
Code: Select all
scp berserk@viking-pc:/home/berserk/berserkfiles/document.txt ~/berserkfiles/document.txt
This will copy document.txt from your remote berserfiles directory to your local berserkfiles directory.
To copy entire directories you can use the -r switch like this:
Code: Select all
scp -r berserk@viking-pc:/home/berserk/berserkfiles ~/
This will copy the berserkfiles directory to ~/
To copy to a remote box:
Code: Select all
scp ~/berserkfiles/document.txt berserk@remote-pc:~/berserkfiles/document.txt
If you are using other ports than 22 you will need to specify the port:
Code: Select all
scp -P 40065 ~/berserkfiles/document.txt berserk@remote-pc:~/berserkfiles/document.txt
Usefull stuff!