mv command moves or renames files or directories within the same file system or between different file systems. you can also do this interactively when you are moving multiple files.mv is similar to doing cut and paste in windows,
To rename a file or a directory.
/home/yogi$mv yog_LIST jeev_LIST
This renames the file from yog_LIST to jeev_LIST
Similarly a directory can be renamed.
To move a file to a directory.
/home/yogi$mv sqlnet.log oracle_logs
Here oracle_logs is a directory.if you want to save the log with a different name,enter
mv sqlnet.log oracle_logs/sqlnet_2011.log
In this case sqlnet.log is renamed to sqlnet_2011.log and saved in oracle_logs directory.
A file,directory or a group of files or directories can be moved to a
/home/yogi$ ls –lrt CONSIGNMNENT*
-rw-r--r-- 1 yogi Administ 58 Dec 24 00:40 CONSIGNMENT1
-rw-r--r-- 1 yogi Administ 6 Dec 24 00:42 CONSIGNMENT2
-rw-r--r-- 1 yogi Administ 978 Dec 25 00:59 CONSIGNMENT3
-rw-r--r-- 1 yogi Administ 27 Jul 25 01:00 lst2.txt
-rw-r--r-- 1 yogi Administ 35 Sep 14 09:00 goods_list
/home/yogi$ mv CONSIGNMNENT* /ALL_CONS/DOCS
This moves all the entities listed above to /ALL_CONS/DOCS directory if it exists, otherwise the command gives an error
mv: cannot rename CONSIGNMENT* to /ALL_CONS/DOCS, a file or directory in the path does not exist.
Remember that when there are more than 2 arguments to mv , the last argument is considered the destination directory. When there are only 2 arguments, if the 2nd argument contains a ‘’/” in it, then the directory structure must exist.
If you want mv to ask you interactively which files are to be moved, use mv –i.
/home/yogi$ mv -i Banks_Draft * DRAFTS/LIST