cp

File Read

cp /path/to/input-file /dev/stdout

File Write

echo DATA | cp /dev/stdin /path/to/output-file

Privilege Escalation

This can be used to copy and then read or write files from a restricted file systems or with elevated privileges. (The GNU version of `cp` has the `--parents` option that can be used to also create the directory hierarchy specified in the source path, to the destination folder.)

cp /path/to/input-file /path/to/output-file

This can copy SUID permissions from any SUID binary (e.g., `/path/to/input-file`) to another.

cp --attributes-only --preserve=all /path/to/input-file /path/to/output-file