Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
labs:unix_basics [2014/01/27 19:42] – [Move or Rename Files] adminlabs:unix_basics [2017/03/15 16:07] (current) – [Move or Rename Files] admin
Line 30: Line 30:
 ==== Copy Files and Directories ==== ==== Copy Files and Directories ====
  
-  * ''cp <source> <destination>'' - copy files +To make a copy of a file (''source'') and name it ''destination''
-   To copy the contents of a directory, use the ''-r'' option.  For example, +
  
-  cp -r <source> <destination>+  cp <source> <destination> 
 +   
 +For example 
 + 
 +  cp myfile.txt myfilecopy.txt 
 + 
 +To copy a directory and its contents, use the ''-r'' option.  ''-r'' means //recursively// For example,  
 + 
 +  cp -r my_src_directory destination_directory
  
 ==== Move or Rename Files ==== ==== Move or Rename Files ====
Line 41: Line 48:
   * ''mv <source> <destination>''   * ''mv <source> <destination>''
  
 +If the destination is a directory, then the file(s) are moved into that directory.
 +
 +For example, to rename ''myfile.txt'' to ''newname.txt'', run
 +
 +  mv myfile.txt newname.txt
 ==== Delete Files ==== ==== Delete Files ====
  
-  * ''rm <file>''delete files+  * ''rm <file>''deletes ''file''
  
 ==== View contents of Files ==== ==== View contents of Files ====
Line 124: Line 136:
  
 Note that what you type for the passwords does not show up on the screen for your security. Note that what you type for the passwords does not show up on the screen for your security.
 +
  
labs/unix_basics.1390851721.txt.gz · Last modified: 2014/01/27 19:42 by admin
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0