CS Student Server - rsync
The easiest way to copy files from your computer to the cs-student server for testing is with rsync.
Installing rsync
Mac/Linux will already have rsync available and do not need to do anything. Windows users need to follow these steps to set up the bash command prompt that is included with git to allow you to use the rsync program.
Install git for Windows (if you do not already have it)
Download this zip file that contains rsynch for git bash. Inside of the .zip file are four files. You need to copy those four files (not the .zip itself) to the directory
C:\Program Files\Git\usr\bin
(if you installed git to a non-standard location, look for theusr\bin
directory in that location).
This will add the rsync
command to Git's bash terminal. To test it, close Git bash if it
is already running, then open Git bash from the start menu. It will provide you a terminal
that uses linux style commands. Type rsync
and hit enter. If you get a long help message followed
by an error from rsync, all is good. If you get a short "command not found" message, rsync is not installed.
Any time you want to use rsync, you will need to use this terminal and not the Windows command prompt. Some tips for doing so:
Command | Function |
---|---|
pwd | Show the directory you are in |
ls | List the files in your current directory |
ls -la | List the files in that location including hidden files and information about the files |
cd /c | Go to the root level of your C drive |
cd /c/Users/YOURNAME | Go to your home folder in Windows |
Using rsync
To upload files to the server
From a terminal window (must be Git bash if on Windows) on your local computer,
navigate to the location that contains the folder you want to copy to the server.
For instance, if you want to copy the folder Assign5
that is in the folder
cs162
, you should navigate to the cs162
folder. Then do the following, but replace FOLDERNAME
with the name of the folder you are trying to copy (like Assign5
).
rsync -a FOLDERNAME USERNAME@cs-student.chemeketa.edu:~/
This will prompt you for your password (for your server account) and then copy the local folder
FOLDERNAME
to your home directory on the server.
To verify, use another terminal window to ssh into the server and verify that the folder is now on the server in your home directory.
If you rerun the rsync command, it will copy any changes from your local files to the server. Assuming you want to edit files on your PC and test on the server, you can make changes locally, then rerun rsync to upload those files to the server.
To download files from the server
If you do find yourself wanting to download files from the server onto your local machine, you can also use rsync for that:
rsync -a USERNAME@cs-student.chemeketa.edu:PATH .
The PATH
you specify should be the name of the folder or file you want to copy
from the server will be interpreted relative to your home directory
on the server. The .
specifies the destination as the current working directory
on your local machine.
Cleaning Up
When you are done testing some code on the folder, you can delete it by navigating
to the directory above it (the place where you can do ls
and see the folder listed) and
doing rm -rf
to it:
rm -rf FOLDERNAME
-r stands for "recursive" - delete all the files and folders inside the named folder. The f stands for "force" - go ahead and delete files without asking for confirmation.