
Introducing the File System
6-16
Copying and Renaming Files
The cp command copies an existing file into a new one. The command cp takes two
arguments, both are either filenames or pathnames to files. First, give the name of
the file you want to copy, followed by the name of the new file, cp oldfile newfile.
For example, cp games/bridge hobbies/bridge.
The mv command moves an existing file into a new one. The command mv takes
two arguments, both are either filenames or pathnames to files. First, give the name
of the file you want to move, followed by the name of the new file, mv file1 file2.
For example, mv games/bridge hobbies/bridge.
The mv and cp commands do not perform the same function. Figure 6-6 displays
the subtle but significant difference. The cp command produces a duplicate file,
maintaining the original file. The mv command also produces a duplicate file; how-
ever, it removes the original file.
If you try to copy or move a file and get the message “Permission denied,” you may
not have the correct file access permission to copy or move the file. Check the file
access permissions with the ll command. If necessary, try to change the file access
permissions; refer to chmod(1) in HP-UX Reference Vol. 1 for more information
about understanding and changing file access permissions. If you cannot change the
file access permissions yourself, contact your system administrator.
Comentários a estes Manuais