LNEXT
ONELCLEAN
UTERMINAL
TERMINAL
NEXT
$V1$
HILINE
PAUSE
MVSYNTAX
COMMAND SYNTAX: link old-filename new-filename
SYSTREE
/
|
--------------------------------------
| | | |
usr bin lib ac
|
-------------------------
| | |
| | |
bin lib md1
SYS2TREE
/
|
--------------------------------------
| | | |
usr bin lib ac
| |
------------ md1
| |
| |
bin lib
GO
The command link is used to create a filename that
points to another file. Linked files and directories
can be removed/unlinked by the unlink command.
Unlike the /etc/ln command, the /etc/link command
links both files and directories! You must be logged in as
root to use this command!
The syntax is shown above.
The main utility of the /etc/link command is apparent when
a major directory substructure is moved from one place to
another, and the new (top directory) is linked to the
old pathname, so that the applications programs that had
hard-coded pathnames can still find the required files!
To understand how to use link,
let us focus on the figure above.
In the figure above the directory /usr/md1 and all files
and directories in the /usr/md1 directory are moved
to the /ac directory.
Following this, any programs that reference the files in the
/usr/md1 directory will not be able to find the required
files. In order to rectify this, the directory (file) /ac/md1
has to be linked to /usr/md1.
Before linking the directories,
please obtain the long listing of
the files in the /ac/md1
directory by entering the
appropriate command at the prompt.
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Please use the ls command with
the -l option.
Please type ls -l /ac/md1
You will be helped this time!
$PROMPT$
FORGET1
ls -l /ac
Please observe a typical result
above and note the highlighted
link counter for the directory
md1!
drwxr-xrwx 1 ac devel 256 July 27 CTI
-rw-r--rw- 1 ac devel 4239 Jan 16 admin
-rw-r--rw- 1 ac devel 11433 April 4 advuser
drwxr-xrwx 1 ac devel 128 July 28 md1
-rw-r--rw- 1 ac devel 5734 Jan 16 unixuser
Enter the necessary command to
make sure that the earlier move of
the directory md1 is
clear to the users.
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Please use the link command.
Please type link /usr/md1 /ac/md1
You will be helped this time!
$PROMPT$
FORGET2
link /usr/md1 /ac/md1
$PROMPT$
If no diagnostic messages appear,
the link was successful!
To verify that indeed the md1
directory appears under /usr,
please get a long listing for the
/usr directory.
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Please use the appropriate
ls command.
Please type ls -l /usr
You will be helped this time!
$PROMPT$
FORGET3
ls -l /usr
Please observe the result above!
$PROMPT$
total 36
drwxr-xr-x 16 root root 432 Jul 9 10:49 CTI
drwxr-xr-x 3 adm uucp 128 Jul 20 10:15 adm
drwxr-xr-x 2 bin bin 2336 Jul 1 10:19 bin
drwxr-xr-x 2 bin bin 48 Oct 15 1985 dict
drwxr-xrwx 2 ac devel 128 Jul 28 11:30 md1
drwxrwxrwx 4 bin bin 272 Apr 23 09:13 games
drwxr-xr-x 8 bin bin 144 Mar 1 09:15 spool
drwxr-xr-x 7 bin bin 112 Oct 15 1985 sys
Note that the number of links for
the md1 directory (file) has
increased to 2.
link is a very powerful command and should be used
with caution, especially when you are dealing with directories
which have several links. Furthermore, files (or directories)
cannot be linked across file systems. Removing a filename
that is linked to another filename has no effect on the other
filename or its contents.