... an additional directory
entry ... to a file or directory. Any number of links can be assigned
to a file. The
number of links does not affect
other file attributes such as size, protections, data, etc.
There are two kinds of links: hard links and symbolic links. Again, according to the Unix documentation:
A hard link (the default) is
a standard directory entry just like the one made when the file was created.
... To
remove a file, all hard links
to it must be removed, including the name by which it
was first created; removing
the last hard link releases
the inode associated with the file.
...
A symbolic link, made with
the -s option, is a special directory entry that points
to another named file. ... In
fact, you can create a symbolic
link that points to a file that is currently absent from the file system;
removing the
file that it points to does
not affect or alter the symbolic link itself.
Why are both symbolic links and hard links useful?
Give a scenario where a hard link would be used instead of a symbolic link,
and a scenario where a symbolic link would be used instead of a hard link.
echo hello > foocreates a file foo (assuming that it doesn't exist), opens the file, writes the string "hello" to the file, and closes the file.