Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ln(1) — GL2 W2.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cpio(1)

ls(1)

rm(1)

chmod(2)

symlink(2)

CP(1)  —  Silicon Graphics

NAME

cp, ln, mv − copy, link or move files

SYNOPSIS

cp file1 [ file2 ...] target
ln [-s] file1 [ file2 ...] target
mv file1 [ file2 ...] target

DESCRIPTION

File1 is copied (linked, moved) to target. Under no circumstance can file1 and target be the same (take care when using sh(1) metacharacters). If target is a directory, then one or more files are copied (linked, moved) to that directory. 

If mv determines that the mode of target forbids writing, it will print the mode (see chmod(2)) and read the standard input for one line (if the standard input is a terminal). If the line begins with y, the move takes place; if not, mv exits. 

Only mv will allow file1 to be a directory, in which case the directory rename will occur only if the two directories have the same parent. 

A link is a directory entry referring to a file; one file (together with its size, all its protection information, etc.)  may have several links to it.  There are two kinds of links:  hard links and symbolic links. 

By default ln makes hard links.  A hard link to a file is indistinguishable from the original directory entry; any changes to a file are effectively independent of the name used to reference the file.  Hard links may not span file systems and may not refer to directories. 

With the -s option ln creates symbolic links.  A symbolic link is a special kind of file whose contents are the name of another file (see symlink(2)). A symbolic link contains the name of the file to which it is linked. Most system calls, including open(2), stat(2), and access(2), substitute these contents when the name of a symbolic link occurs in a pathname. This process is known as "following" symbolic links. Link(2), lstat(2), readlink(2), symlink(2), and unlink(2) also do this substitution, except on the last component of the pathname. Thus, they are said to "not follow" symbolic links. Symbolic links may span file systems and may refer to directories. Note that cp "follows" symbolic links, while mv and ln do "not follow" symbolic links. 

EXAMPLE

cp alpha beta gamma /roxanne

places copies of the three files in the directory /roxanne. 

SEE ALSO

cpio(1), ls(1), rm(1), chmod(2), symlink(2). 

BUGS

If file1 and target lie on different file systems, mv must copy the file and delete the original.  In this case the owner name becomes that of the copying process and any linking relationship with other files is lost. 

Version 2.3  —  July 04, 1985

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026