• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 19. Unix Basics for Mac OS X > Copying & Moving Files

Copying & Moving Files

Unix also includes commands for copying and moving files: cp and mv. These commands enable you to copy or move one or more source files to a target file or directory.

✓ Tips

  • Why copy a file? Usually, to make a backup. For instance, before you edit a configuration file, you should create a backup copy of the original. This way you can revert back to the original if your edits “break” something in the file.

  • The mv command can also be used to rename a file.

  • The cp and mv commands support several options. You can learn more about them in the man pages for these commands. Type man cp or man mv and press to view each command’s man pages.

  • Unix does not confirm that a file has been copied or moved when you correctly enter a command (Figures 21 and 22). To check to see if a file has been copied or moved to the correct destination, you can use the ls command to get a listing for the target directory. The ls command is covered earlier in this chapter.

    Figure 21. Here’s the cp command in action.

    Figure 22. Here’s the mv command in use.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint