Commands: CP and MVyfeaste/cpsc101/CPSC101F15Yvon...Commands: CP and MV . Unix/LinuxCommandCP ! •...

Preview:

Citation preview

 Commands: CP and MV

Unix/Linux  Command  CP  •  CP  is  the  command  used  in  Unix  and  Linux  to  copy  your  files  or  directories.  

(http://www.rapidtables.com/code/linux/cp.htm)  

Examples  of  the  CP  command:  •  cp  -­‐u  *.txt  newdir  

•  Copies  any  file  with  the  extension  “.txt”  to  the  directory  “newdir”  if  the  files  do  not  already  exist,  or  are  newer  than  the  files  currently  in  the  directory.  The  option  “-­‐u”  means  “update,”  so  this  is  why  it  will  only  copy  the  files  this  way.  

•  cp  file1.txt  newdir  

•  Copies  the  file  “file1.txt”  from  the  currently  selected  directory  to  the  “newdir”  directory  

Unix/Linux  Command  MV  •  MV  is  the  command  used  in  Unix  and  Linux  to  move  or  rename  files  or  directories.    

(http://www.rapidtables.com/code/linux/mv.htm)  

Examples  of  the  MV  command:  •  mv  file1.txt  newdir  

•  Moves  the  file  “file1.txt”  to  the  directory  “newdir”  

•  mv  myfile  subdir/myfile2  •  Moves  the  file  “myfile”  to  the  sub-­‐directory  named  “myfile2”  

•  mv  bak  bak2  •  Rename  the  directory  “bak”  to  “bak2”  

Recommended