5
Commands: CP and MV

Commands: CP and MVyfeaste/cpsc101/CPSC101F15Yvon...Commands: CP and MV . Unix/LinuxCommandCP ! • CP#is#the#command#used#in#Unix#and#Linux#to#copy#your#files#or#directories

Embed Size (px)

Citation preview

Page 1: Commands: CP and MVyfeaste/cpsc101/CPSC101F15Yvon...Commands: CP and MV . Unix/LinuxCommandCP ! • CP#is#the#command#used#in#Unix#and#Linux#to#copy#your#files#or#directories

 Commands: CP and MV

Page 2: Commands: CP and MVyfeaste/cpsc101/CPSC101F15Yvon...Commands: CP and MV . Unix/LinuxCommandCP ! • CP#is#the#command#used#in#Unix#and#Linux#to#copy#your#files#or#directories

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)  

Page 3: Commands: CP and MVyfeaste/cpsc101/CPSC101F15Yvon...Commands: CP and MV . Unix/LinuxCommandCP ! • CP#is#the#command#used#in#Unix#and#Linux#to#copy#your#files#or#directories

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  

Page 4: Commands: CP and MVyfeaste/cpsc101/CPSC101F15Yvon...Commands: CP and MV . Unix/LinuxCommandCP ! • CP#is#the#command#used#in#Unix#and#Linux#to#copy#your#files#or#directories

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)  

Page 5: Commands: CP and MVyfeaste/cpsc101/CPSC101F15Yvon...Commands: CP and MV . Unix/LinuxCommandCP ! • CP#is#the#command#used#in#Unix#and#Linux#to#copy#your#files#or#directories

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”