242 Part II . Getting Around in Linux (Web hosting e commerce)

242 Part II . Getting Around in Linux cp The cp command (short for copy) is used for standard file copies on Linux systems. This command is used to create a new, independent copy of the original file or directory. Several options are used with the cpcommand to customize the copies created. These options are covered below in Table 6-7. Table 6-7 Options Used with cp Option Use -d Specifies that links are to be preserved when copied. -f Overwrites any existing destination files. -i Prompts before overwriting any existing destination files. -l Specifies that hard links, which are discussed later in the chapter, are to be created instead of copies of files. -p Preserves the original file s owner, group, permissions, and time stamps. -r Copies directories and contents recursively while copying all files as standard files. This option shouldn t be used with special files. -R Copies directories and contents recursively, preserving nondirectories. -s Creates symbolic links, covered later in the chapter, of nondirectory files. -v Displays the names of all files as they are being copied. -a Specifies that links and attributes of the original files are to be transferred to the new copy. These options can be used in combination when copying files. Along with these options, arguments are used with the cp command. The correct syntax for the cp command is as follows: cp -option source target When the target specified is a directory, the source file is copied to that directory with the same name as the original file. When the target specified is not a directory, the original file is copied to the specified location with the target name. The following are some examples of the use of the cp command. In the first example the file marital is copied to the directory stuff. # cp marital stuff
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Leave a Reply