File Transfer and SSH

Well I’m not going to explain what SSH is (mainly because I would not do it much justice), so instead I will direct you to these pages if you wish to find out more. Suso Technology Services Inc. and Wikipedia.

Now suppose you want to SSH into a remote computer (one that I hope you know the name of) it is “pretty easy”. For this let us say that on that computer your username is NewKid and the host computer is FarAway.Land.ofDreams.

Then to connect to it from your computer you just enter

ssh NewKid@FarAway.Land.ofDreams

If prompted for a password then enter it. And look you are now connected.  At this point you will be able to perform whatever you want on the other computer.  However, there is no GUI so hope you like command line (which by now you should).

Now a lot of good this would do if you weren’t able to send and receive files between the two computers.  Suppose there is a file ~/urgent that you need to send to the remote computer, and wish to place it on the Desktop (~/Desktop).  Well you are in luck there is a simple way to do this.

scp ~/urgent NewKid@FarAway.Land.ofDreams:~/Desktop

There is a space between ~/urgent and NewKid… Note that if you had instead entered

scp ~/urgent NewKid@FarAway.Land.ofDreams

The file would have been placed in the home folder on the remote computer.

Now instead let us assume that ~/urgent was on the remote computer and we needed it on the local one (the one we are physically at).  In this case we run

scp NewKid@FarAway.Land.ofDreams:~/urgent ~/Desktop

Here we have copied ~/urgent to our Desktop. Similarly if we had not put ~/Desktop it would have been copied to our home directory.

Overall the usage of scp is

scp [user@from-host]:source [user@to-host]:destination

Really this post is as much a reference for me as it is a learning tool for others. Since I know that I will need to be sending and getting files quite often in the near future and am pretty sure that I will forget how right before I need to start. But hopefully, I will get back to talking about the Linux file system soon enough. Sorry for the ‘side post’, but I really do hope that someone will find it useful.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: