Command Line Examples: mv

From PHYSpedia
Revision as of 09:45, 7 February 2013 by Cclark (talk | contribs) (Created page with "The mv command will do different things depending on how many arguments you give it. In the following examples, assume that we are in the directory <code>/home/user/work/example…")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The mv command will do different things depending on how many arguments you give it.

In the following examples, assume that we are in the directory /home/user/work/examples; there are two files named file1.txt and file2.txt; there is a sub-directory named finished. Note that these examples could not be run in order.


To "rename" file, just move it to a file with a different name


user@host:examples$ mv file.txt newname.txt

move the file to a subdirectory


user@host:examples$ mv file.txt finished/