Next: The X Window System
Up: Moving Information
Previous: Pruning Back with rm
Finally, the other file command you should be aware of is mv.
mv looks a lot like cp, except that it deletes the original file
after copying it. Thus, it's a lot like using cp and rm
together. Let's take a look at what we can do:
As you can see, mv will rename a file if the second parameter is a
file. If the second parameter is a directory, mv will move the file
to the new directory, keeping it's shortname the same:
mv old-name new-name
mv file1 file2 ...fileN new-directory
You should be very careful with mv--it doesn't check
to see if the file already exists, and will remove any old file in its way.
For instance, if I had a file named frog already in my directory
report, the command mv frog report would delete the file
~/report/frog and replace it with ~/frog.
In fact, there is one way to make rm, cp and mv ask
you before deleting files. The -i option. If you use an
alias, you can make the shell do rm -i automatically when you
type rm. You'll learn more about this later.
Converted on:
Mon Apr 1 08:59:56 EST 1996
|