The cp command is used to copy a file. To create a copy of the file temp1 with name temp6 type
cp temp1 temp6
If the file temp6 already exists it will be overwritten without a warning.
Therefore, one has to be careful. The command with option '-i',
cp -i temp1 temp6
prompts for confirmation before overwriting an existing file and is thus safer to use.
To remove the file temp6 use
rm temp6
The mv command renames files or moves files from one directory into another directory.
For example, to rename file temp1 to temp4 execute:
mv temp1 temp4
As with cp, if temp4 already exists it will be overwritten.
A directory containing files cannot be deleted. It must be emptied first usingrm, mv etc.
The empty directory is deleted using rmdir.
Example:
cd ..
rm temp/temp4
rm temp/temp2
rm temp/temp3
rmdir temp
As an exercise you should familiarize yourself with other commands, such as cat, more, less, head, tail and diff that are useful for examining contents of files.