Remove (rm) and Move (mv)

Removing Files with rm

Use the rm (remove) command to delete files or folders from your NFS space. Deleted files are permanently removed, so be careful when using this command!

By default, rm does not ask for confirmation before deleting.

eos$ rm [options] filename

Common Options

OptionDescription
-rRemove directories recursively
-fForce deletion without confirmation
-rfDelete folders and contents without prompts
-iAsk before deleting each file

To delete a folder and all its contents:

eos$ rm -rf old_folder

Will I See Output?

No, unless you use -i. Then you’ll see:

rm: remove regular file 'file.txt'?

Moving or Renaming with mv

Use the mv (move) command to move a file to another folder, or to rename it.

eos$ mv source destination

Example 1: Rename a File

How would you rename the file oldstuff.txt to junk.txt while in your home directory?

eos$ mv oldstuff.txt Junk.txt

Example 2: Move a File

How would you move the file assignment from your home directory to your MyE115 directory?

eos$ mv hw3.txt MyE115/

Will I See Output?

No. The mv command is silent unless something goes wrong.