Basic Linux Tutorial
Computer Tutorial

Working with Files (cp & mv Commands)



Working with Files (cp & mv Commands)

cp

the cp command are used it make copies of files and directory.
Synopsis :
cp [option] source   destination
Example :
cp   file1.txt   file2.txt
Option
-a   archive files
-f   force copy by removing the destination file
-n   no file overwrite
-R   recursive copy (including hidden file)
-n   no file overwrite
-v   print information message
-i   prevent cp from overwriting existing files

mv

mv command are used to rename or to move the file to another directory.
Synopsis :
mv [option] source   destination
Example :
mv   file1.txt   new/file2.txt
Option
-f   force move by overwriting destination file without prompt
-i   interactive prompt before overwriting
-u   update move when source is newer then destination
-v   print source and destination file