Command cp
Copy one regular file, including between volumes.
Synopsis
cp source destinationOrdinary invocation: foreground child, PID 3; the shell waits. Not an allowed pipe producer.
Parameters
| Parameter | Meaning |
|---|---|
source | Regular MKS2 file, or /dev/null for an empty source. |
destination | File path, existing destination directory, /dev/null, or /dev/console. |
Description
An existing directory receives the source basename. A file destination is replaced on successful completion; there is no overwrite confirmation. Copying uses a reader and the single writer handle, with 256-byte transfers and yields between sectors.
The source checksum must pass before the destination is published. A read failure, write failure or failed commit aborts the pending destination and preserves any previous target.
/dev/null as destination discards bytes while still reading and checking the source. A console destination prints them. An empty null source can create or truncate a regular file to zero bytes.
Examples
cp /mnt/smp0/demo.bas /mnt/smp1/demo.bas
cp demo.bas work
cp demo.bas /dev/null
cp /dev/null empty.txtLimits and side effects
- No recursive directory copy, wildcards, append or interactive console-to-file capture. Files need contiguous free space, including space for an uncommitted replacement. CP is not a pipe producer.
Status and diagnostics
Success is status 0. Relevant status codes: 1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 15, 18. See the diagnostic reference.
See also
mv · cat · rm · Shell syntax