Copy command in terminal mac os x

As with the example under "cp", the quotes are needed because of the space in the directory name. Note that with CpMac , the -r option is lowercase, while cp takes it capitalized.

How to Use the Command Line for Apple macOS and Linux

Note that CpMac doesn't allow multiple options after a single - , so -r -p must be used instead of just -rp. If used with root access, it also preserves security information e. Note: Unlike cp -R , with ditto if a directory by the destination name already exists, the existing contents will be merged with the contents of the directory being copied.

Examples: ditto Documents "Documents backup" copy an entire directory named "Documents"; name the copy "Documents backup". As with previous examples, the quotes are needed because of the space in the directory name. Using the sudo command allows you to perform functions as another user.

When you execute the command, the command line asks you for a password. After you enter the correct password, the command executes as desired. The curious reader might want to know that sudo stands for set user and do.

It sets the user to the one that you specify and performs the command that follows the username. A close cousin to the cp copy command is the mv move command. As you can probably guess, the mv command moves a folder or file from one location to another.

Again, like the cp command, the mv command requires that you have proper permissions for the action you want to perform. On Unix systems, not all users are necessarily equal. What would file manipulation be without the capability to delete files?