UNIX Primer

Home | Primer Home

Manipulating Files

As you might have suspected, we are not always happy with the way our files are arranged. To remedy this, we have commands available to us that let us copy, move and rename files.

Also, there are a number of text editors available which let us change our files. Although none of these are covered in detail here or supported by the staff, the following list of editor names should be a good starting point for your research if you're looking for a text editor:

Before you move on, take a few moments to play with the following commands.

Related Commands:

cp CoPy To make exact copies of files.
cp <filename> <copy_filename>
cp -r <dirname> <copy_dirname>
  • Using the -r (recurse) option, you can copy whole directories.
  • Keep in mind that <filename> and <copy_filename> can include a path to any directory.

mv MoVe Changing file locations and names.
mv <old_filename> <new_filename>
  • This command can move files between directories.
  • You can rename files using this command.
  • You can do both of the above simultaneously.
  • Directories can be moved like this as well.
  • Keep in mind that <old_filename> and <new_filename> can include a path to any directory.

Designed by D. Kaminsky
Edited by Diana Palsetia
© University of Pennsylvania, 2008