University of Southern California

ITS Information Technology Services

A division of the Office of the Chief Information Officer

Transferring Files

Introduction

Files can be transferred between various accounts on either the same or different host.

File Transfer Within the Same UNIX Host

For simple file transfers within the same UNIX host, you can use the cp command.

For info on using cp for copying files within the same account, see the ITS documentation at Directory Commands.

To copy files between two user's accounts, type:

The following example will take a copy of the file assign1 from the account comp101 and will put a copy of the file in the account ttrojan in the directory classes called hwassign.

Note: This will work only if you have write permissions to the other user's specified directory.

Between two UNIX Hosts at USC

For file transfers between two different hosts at USC, you can use the rcp command. However, you need to be able to login to both hosts without a password. You can do this by setting up a .rhosts file in both accounts. The syntax for the rcp command is:

The above example will take a copy of the file hw1sol from the account ee101 on the host aludra and put a copy of the file in the account htroy on the host mizar in the directory classes called sol1.

File Transfer Between Machines

For file transfer between machines, you can use the ftp command.

To use ftp between two UNIX hosts, you must have an account on both hosts.

You can also transfer files via e-mail. Most e-mail applications allow you to insert a file into your message. Some applications also allow you to send a file as a separate attachment. See ITS documentation on the supported e-mail applications at our Email Documentation for more information.

If you are including a binary (executable) file into an e-mail message, you will need to encode the file. You do not need to encode a binary file if you are sending it as an attachment. To encode a file, type:

Where <binary_filename> is the name of the binary file you wish to encode, <label_name> is the name of the file that will be created when the person receiving the encoded file decodes it (you can use the same name as the <binary_filename>), and <encoded_filename> is the name of the encoded file you are creating.

The above example will take the binary file myprog, encode it and create a new file called encodedprog. When the receiver decodes encodedprog, a file called yourprog will be created in their account.

To decode an encoded file, type:

Last updated:
February 04, 2011

UNIX Documentation

The use of all USC computing resources is governed by the USC Computing Policies.