Visual QuickStart Guide [Electronic resources] : Mac OS X 10.4 Tiger نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Visual QuickStart Guide [Electronic resources] : Mac OS X 10.4 Tiger - نسخه متنی

Maria Langer

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید





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.


To copy a file to the same directory


Type cp

source-file target-file and press (Figure 21 ).

For example, cp file.conf file.conf-orig would duplicate the file named

file.conf and assign the name

file.conf-orig to the duplicate copy.

Tips

  • The

    source-file and

    target-file names must be different.

  • The

    source-file operand can be a file or a directory.

To copy files to another directory


Type cp

source-file

target-directory and press (Figure 21 ).

For example, cp file.conf /Users/ronh/Documents would copy the file named

file.conf in the current directory to the directory named

Documents in my home folder.

To copy files using a wildcard


Type cp followed by the wildcard search string for the source file and the name of the target directory and press (Figure 21 ).

For example, cp *.conf Originals would copy all files ending with

.conf in the current directory to the subdirectory named

Originals .

To rename a file


Type mv

source target and press (Figure 22 ).

For example, mv file.conf file.conf-backup would rename

file.conf as

file.conf-backup .

To move files to another directory


Type mv

source

directory and press (Figure 22 ).

For example, mv file.conf Documents would move the file named

file.conf in the current directory to the subdirectory named

Documents .

To move a file to another directory & rename it


Type mv

source directory/filename and press (

/ 300