Usage: ncp [option]... <SOURCE>... [DESTINATION]
Options:
-A, --acl Preserve ACL (access control list).
-a, --archive Archive mode (equivalent to -Dfmort).
-D Same as --special --devices.
--devices Preserve device files.
-f Same as --unlink=force.
-g, --group Preserve group ownership.
-H, --hard-links Preserve hard links.
-h, --help Show this help message and exit.
-i, --interactive Prompt before overwriting files.
-j, --jobs=<N> Number of files to copy in parallel (max: 16).
-L, --follow-links Dereference source symlinks (default when non-recursive).
-M, --move Remove source files after copying.
-m, --mode Preserve file permissions (mode bits).
-n Same as --unlink=never.
-o, --ownership Same as --user --group.
-P, --keep-links Preserve source symlinks (default when recursive).
-p, --progress Show progress bar.
-r, --recursive Copy directories recursively.
--special Preserve named pipes and sockets.
-T, --target=<dir> Target directory to copy into.
-t, --time Preserve modification time.
-U Same as --update=older.
--unlink=[when] Unlink destination before writing. [when] can be one of:
'never', 'always', 'force' or 'auto'.
If [when] is omitted, 'always' is assumed.
If the option is omitted entirely, 'auto' is used.
--update=[when] Update existing files. [when] can be one of:
'none', 'all', 'older', 'changed' (size or time) or 'size'.
If [when] is omitted, 'older' is assumed.
If the option is omitted entirely, all files are updated,
which is equivalent to --update=all.
-u, --user Preserve user ownership.
-V, --version Show program version and exit.
-v, --verbose Explain what is being done.
Parameters:
SOURCE Files or directories to copy or move.
DESTINATION Destination file or directory.By default, ncp copies just the file contents. Owner, group, permissions,
modification time, and ACL are preserved only when requested with the --user,
--group, --mode, --time, and --acl options respectively. Otherwise, new files
receive the current time, your ownership, and default permissions (subject to
umask).
Only root, or a process with the CAP_CHOWN capability, can change the owner
of a file. Without it, the --user option (also implied by --ownership and
--archive) has no effect and copied files are owned by you, while --group works
only for groups you belong to. If --mode is also in effect, the setuid and
setgid bits are removed from copies of files that belong to other users.
Symlinks in the source are followed (resolved to the file they point to) when
copying non-recursively, and copied as links when copying recursively. Use the
--follow-links or --keep-links option to override this default.
Symlinks at the destination are also followed, except when a source symlink is copied as a link or in move mode. In those cases, the destination symlink itself is replaced.
Directories are only copied when the --recursive option is specified.
Following rsync's convention, a trailing slash on a source means "the contents
of". For example:
ncp --recursive dir/ dest # Copies the contents of dir into dest.
ncp --recursive dir dest # Copies dir itself, as dest/dir if dest is an
# existing directory, or as dest otherwise.When recursing, device files are skipped unless the --devices option is
given, and named pipes and sockets are skipped unless --special is given.
The --archive option is meant for making copies, such as backups and data
migration, where you want to preserve as much as possible, including
attributes, symlinks, special files, and so on.
It is shorthand for -Dfmort and does not include --acl or --hard-links,
which you should add manually if the destination filesystem supports them.
The --move option (or running the program as the nmv symlink) implies
--recursive. Symlinks are moved as links and never followed. If the source and
destination are on the same filesystem, items are simply renamed; otherwise
they are copied and then removed.
The --unlink option controls whether an existing destination is removed
before it is written:
-
autoOverwrite regular files in place, preserving their inode, ownership and hard links. Replace the destination only when its type differs from the source. This is the default. -
forceLikeauto, but if a regular file cannot be opened for writing (for example, it is read-only), remove it and try again. -
neverDo not remove anything. Regular files are overwritten in place; a destination of a different type than the source is an error. -
alwaysRemove the destination and create a new one in its place.
The --update option decides what happens when the destination already
exists. Directories are not affected by this option.
-
noneNever overwrite existing files. -
allAlways overwrite them. This is the default. -
changedOverwrite only if the size or modification time differs. Otherwise, the destination is considered up to date and its contents are not copied. Attributes are still updated (if requested) and, with--move, the source is removed. -
sizeLikechanged, but compares only the size. -
olderOverwrite only if the destination has an older modification time. Unlikechangedandsize, a destination that is not older than the source is skipped entirely, including attributes.
If a source given on the command line is a device, named pipe or socket, or if the destination is one, ncp behaves like cp, reading the data from the source and writing it to the destination.
ncp /dev/sda disk.img # Reads the device into a regular file.
ncp disk.img /dev/sdb # Writes the image to the device.
ncp pipe file # Saves whatever is written to the pipe.This applies only to command-line arguments, never to items found while
recursing, and is not used with --move.
CAUTION: If any of the --devices, --special, or --archive options are
specified, ncp will copy the source itself rather than its data, replacing the
destination. Likewise, with --unlink=always, a destination device will be
removed and replaced instead of being written to.
The --interactive option prompts before overwriting an existing
destination. Each prompt accepts y (yes, the default), n (no), a (yes to
all remaining), s (skip all remaining) or q (quit).
The --jobs option allows ncp to copy several files at the same time. This
can speed up transfers on SSDs and network drives, but is unlikely to help, and
may even slow things down, on mechanical hard drives.
0Success.1Invalid arguments.2Interrupted by a signal.3One or more items could not be copied.4Copied, but some attributes could not be preserved.
Binary packages for Debian, Ubuntu, RaspberryPi and other Debian-based distributions can be installed from the CCCP Linux Package Archive. Follow their instructions to set up the archive and be sure to add the main component. After that:
sudo apt install ncpTODO
Share and enjoy.
- Dimitry Ishenko - dimitry (dot) ishenko (at) (gee) mail (dot) com
This project is distributed under the GNU GPL license. See the LICENSE.md file for details.