Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have no Linux experience, all I know and want to do is this:

There is a JAR file on my local computer that I want to copy to a remote box. I think it is a Linux box, and I do a ssh to connect to it like this:

ssh myUserName@boxName

and then I enter my password and I connect to it.

Now I just want to copy a local file from my machine to that remote box.

share|improve this question
add comment

migrated from stackoverflow.com Apr 25 '13 at 16:32

This question came from our site for professional and enthusiast programmers.

4 Answers

up vote 1 down vote accepted

most of the ssh enabled boxes have sftp enabled.

You can try to sftp to the box using

sftp myUserName@boxName

put filename

share|improve this answer
    
sftp worked but "puts" said "invalid command" .. so it is not enabled? –  EricFromSouthPark Apr 25 '13 at 14:50
2  
my bad its 'put' and not 'puts' –  Pradheep Apr 25 '13 at 14:50
add comment

Use the scp command:

scp file.txt user@remote.host:/path/to/file.txt

From the man page:

scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1).

share|improve this answer
add comment

You can use the 'scp' (secure copy) command to do this:

scp file.jar myUserName@boxName:/path/to/destination

And, to get it back (to your current directory), just reverse the arguments:

scp myUserName@boxName:/path/to/destination/file.jar .

If you're wanting to do directories recursively, you can do that with scp by passing the -r switch along with a directory location. I'd suggest having a look at rsync if you want to do this, however, as it contains some cool optimisations for copying large directories.

Tom.

share|improve this answer
add comment

scp localfileName myUserName@boxName:remotefileName

scp is secure copy and runs over ssh.

Check man scp for details

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.