Command Line Tools

Command line tools

Command line tools can be much quicker to use although less user friendly since you need to remember particular options rather than picking from menus etc.

RSYNC

rsync is particularly useful to synchronise a set of files from one system to another, e.g.

rsync -aHSv username@gate.maths.ox.ac.uk: copy_of_maths_account

would sync a copy of all the files in your maths account to a folder on your local (typically non-maths) machines called copy_of_maths_account. If this command is interrupted you can simply restart it and it will work out what remains to be synced. Note the options above do not cause it to delete files in the local copy that have since been removed from the remote copy, if you want to do that too then include the options --force --delete

SCP

scp is a secure copy command. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. To copy a file from a remote machine the command would be of the form

scp username@fully_qualified_machine_name:path_to_file destination_file_name

For example

scp bloggs@gate.maths.ox.ac.uk:filename .

would copy the file called filename from my home directory on the MI computer system to my current directory on my local machine keeping the name the same (the . dot being the destination name meaning this directory with the same name).

SFTP

sftp should work in the same way as ftp described below except that for the data transfer it will use ssh and thus be secure (e.g. no clear text password is sent).

FTP

This is the standard method for transferring files to and from machines connected to the internet (for example most of the computers in the University).

The following are a list of commonly used commands:

cd
Changes between directories.
ls
Lists files in a directory.
pwd
Prints working directory.
ascii
Puts file transfer in ASCII mode (text files).
binary
Puts file transfer in binary mode for non-text files.
bye
Quits ftp.
get
Gets a remote file.
put
Puts a local file on the remote system.
prompt
Forces (non)-interactive prompting on ``multiple'' commands
mget
Gets multiple files.
mput
Puts multiple files.

So, for example,

alph% ftp sable
Connected to sable.
220 sable.ox.ac.uk FTP server ready.
Name (sable:newuser): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
230-Trouble from multi-line replies? Reconnect with a '-' before the password.
230-
230 Guest login ok, access restrictions apply.
Remote system type is Unix.
Using binary mode to transfer files.
ftp> cd pub
250-Please read the file README
250- it was last modified on Thu Dec 22 12:09:42 1994 - 53 days ago
250 CWD command successful.
ftp> ascii
200 Type set to A.
ftp> get README
200 PORT command successful.
150 Opening ASCII mode data connection for README (1640 bytes).
226 Transfer complete.
1689 bytes received in 0.099 seconds (17 Kbytes/s)
ftp> bye
221 Goodbye.
alph%

Anonymous FTP

In anonymous FTP, you use the standard FTP commands described above, but this time when asked to login you use the username anonymous. You will then usually be prompted to ``Enter your e-mail address as password''. Usually @email will suffice.

Please contact us with feedback and comments about this page. Last updated on 25 Mar 2022 15:43.