## ln

#### OS/161 Reference Manual

### Name

ln - link files

### Synopsis

`/bin/ln` oldfile newfile
`/bin/ln -s` oldfile newfile

### Description

ln creates links to files. The first usage creates a hard link, that is, an additional name for the same file. The second usage, with the -s option, creates a symbolic link, a special filesystem entry that redirects accesses back to the first original file.

The symlink created is of the form newfile -> oldfile.

Note that `ln` does not support the Unix idiom `ln file1 file2 ... destination-dir` to link a number of files at once. In particular, `ln foo bar/` will fail, probably with "Is a directory".

### Requirements

`ln` uses the following syscalls:

- link
- symlink
- write
- _exit

`ln` without the -s option should work once (or if) you implement hard links. `ln` with the -s option should work once (or if) you implement symbolic links. Check your assignments for when (or if) you need to implement these features.

`ln` is able to create symlinks even if hard links are not implemented, and vice versa.

### See Also

cp, mv