COPY(1XNX)

πŸ“¦ version 070715, in nixos 26.05, nixpkgs unstable

πŸ’– COPY(1XNX) πŸ’–

okay so welcome to the XENIX System Compatibility corner of the manual, bestie. this page is all about copy, and it is literally here to copy groups of files for you. no cap. 🫢


🌸 NAME 🌸

copy β€” (XENIX) copy groups of files


✨ SYNOPSIS ✨

copy [-a[d]] [-nlsmorvh] source . . . [destination]

πŸ’« DESCRIPTION πŸ’«

the copy command creates a copy of each source file in destination. if there is no destination argument, the current directory is used. main character energy: the current directory is the default destination. πŸ’…

if more than one source argument is given, destination must be an existing directory; otherwise, if destination does not exist, it is created.

for a directory given as source, its contents are copied to destination, but subdirectories are normally ignored (see the -r option below). special files are copied as such. yes bestie, special files keep their special-file vibe. ✨

if a destination file exists, its content will be overwritten, but it will retain its permissions and ownership. otherwise, files are created with the owner and group set to those of the invoking user and with the permissions of the source file (minus umask, see umask(2)). okay so lowkey important: existing destination files keep their perms and ownership even when the content gets replaced. πŸ‘‘

overwrite alert 🚨 if the destination file already exists, its content gets replaced β€” but its permissions and ownership stay exactly as they were.

the copy command accepts the following options, which may be given at any position regarding the file operands:


πŸŽ€ OPTIONS πŸŽ€

  • -a β€” asks for confirmation for each file before a copy is attempted, and for each directory before it is examined. very β€œare you sure, bestie?” energy. πŸ™ˆ
  • -ad β€” asks for confirmation for each directory before it is examined. implies the -r option.
  • -h β€” by default, symbolic links are followed. this option causes symbolic links encountered during traversal to be copied (symbolic links given as arguments will still be followed). this option is an extension.
  • -l β€” if possible, files are hard linked instead of being copied. this does not apply to directories or special files.
  • -m β€” sets access and modification times of copied files to those of source files instead of current time. preserving the timestamp glow-up. ⏰
  • -n β€” create new files only: if a destination file exists, it is not overwritten. no touching the existing files, periodt.
  • -o β€” sets the owner and group of each destination file to those of the source file instead of those of the invoking user.
  • -r β€” recursively copies subdirectories of the source arguments encountered.
  • -s β€” similar to -l, but uses soft links. this option is an extension.
  • -v β€” prints the name of each file or directory before it is copied or examined. narrator mode: on. 🎀

πŸ¦‹ SEE ALSO πŸ¦‹

cp(1), cpio(1)


πŸ“ NOTES πŸ“

files copied will lose all hard link connection. that is a real caveat, bestie β€” not a drill. πŸ’€

in contrast to cp(1), if a directory is copied to an existing destination directory, its contents will be written directly into that directory, without a subdirectory being created. for example, if the directory source contains the files file1 and file2, the command

copy source dest

will create files dest/file1 and dest/file2, while the command

cp -r source dest

will create dest/source/file1 and dest/source/file2.

thus if a single directory is named and no explicit destination is given, copies of the files below that directory will be created in the current directory. the way that changes everything, honestly. πŸŒ€


🫢 from the Heirloom Toolchest, dated 12/8/04 β€” page name COPY(1XNX). bye bestie, go copy something iconic πŸ’…βœ¨
πŸ“¦ where this page comes from