Linking files (ln), Hard links, Symbolic links – HP NonStop G-Series User Manual
Page 108: Links and file systems, Hard links symbolic links links and file systems

$ rm -i record?
Before removing each file, the system prompts you, and with a y or n response to the prompt, you
can tell the system whether to remove each file:
rm: remove record1? n
rm: remove record2? y
rm: remove record3? y
rm: remove record4? y
rm: remove record5? y
rm: remove record6? n
In this example, all files except record1 and record6 are removed.
In addition to removing one or more files, the rm command also provides an option, the -r flag,
which removes files and directories at the same time, without prompting you.
Linking Files (ln)
A link is a connection between a filename and the file itself. Usually, a file has one link—a
connection to its original filename. However, you can use the ln (link) command to connect a file
to more than one filename at the same time.
Links are convenient whenever you need to work with the same data in more than one place.
Open System Services supports both hard links and symbolic links. The default specification is hard
links.
Hard Links
Hard links are connections between a file and multiple names for that file. When you create a
hard link, you are providing another name for the file. All the hard-linked names for a file, including
the original name, are of equal status. It is incorrect to think of one filename as the real name and
another as only a link.
Hard links can be made only between files and filenames that are in the same file system.
Changes made to a file appear in the file when it is opened under linked names.
A file with hard-linked names persists until all its names have been removed.
Symbolic Links
A symbolic link (also known as a “soft link”) consists of a file that contains a pointer to another file
or directory. This pointer is simply the pathname to the destination file or directory. Only the original
name is the real name of the file or directory. The file containing the pointer, and its filename, are
distinct from the linked file.
Symbolic links allow you to link both files and directories. In addition, you can link both files and
directories across different file systems.
Changes you make to a file appear in the file when it is opened under different names.
Specify symbolic links by using the -s flag with the ln command.
A file with symbolic links is removed when its original name is deleted; any remaining symbolic
links then point to a nonexistent file.
Links and File Systems
The term “file system” as used in this discussion of links differs from its earlier usage in this guide.
Previously, a file system was defined as a useful arrangement of files into a directory structure.
Here, the same term acquires a more precise meaning: the files and directories contained within
108 Managing Files