Transferring files

Transferring files to and from a server

When working with a remote server you will need to transfer files to and from the server. You can either do this with a GUI client such as filezilla or fugu or you can do it with the commandline tool scp.

If you are planning to work from an external network (e.g. from home) then fugu is the only GUI software that can help you (and it's only available for mac), however scp will work from any network/platform.

The syntax of scp is very similar to that of cp (to copy files). It follow the general pattern

scp files_to_transfer new_location 

This can be read as "I want to copy (scp) these files (file_to_transfer) to a new location (new_location)"

Home to server

So for example, if you have a file called data.txt on your laptop and you want to copy it to the server (ip address: 10.18.0.11, username: jody) then you can do the following.

scp data.txt jody@10.18.0.11:

In this case I want my files to go to the servert so my new_location parameter is username@ipaddress:

Don't forget about the colon at the end of the server address. It won't work if you leave this out

Server to home

If you have a file called data.txt on the server that you want to transfer to you computer then you can do the following

scp jody@10.18.0.11:data.txt .

Note how the 3rd parameter is just a dot. This is a special variable in bash which meant he current location. So the file will be transferred to the folder you are currently in.

If your files on the server are in a sub-folder (e.g. beast/data.txt) then you can just add that to the remote file descriptor. You can also transfer into a different folder on your own computer (e.g. ~/Documents).

scp jody@10.18.0.11:beast/data.txt ~/Documents/

Last updated