Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Files

Status
Not open for further replies.

redwings

MIS
Aug 6, 2001
93
US
How do I link a file? Do I create the new file and then link it to the old one?

Any help would be great...

Thanks.
 
Hard or symbolic links?





-f
Causes the ln command to replace any destination paths that already exist.
If a destination path already exists and the -f flag is not specified, the ln
command writes a diagnostic message to standard error without
creating a new link and continues to link the remaining SourceFiles.

-s
Causes the ln command to create symbolic links. A symbolic link contains
the name of the file to which it is linked. The referenced file is used
when an open operation is performed on the link. A stat call on a
symbolic link returns the linked-to file; an lstat call must be done to
obtain information about the link. The readlink call may be used to
read the contents of a symbolic link. Symbolic links can span file
systems and refer to directories.

Notes:
1.You cannot link files across file systems without using the -s flag.
2.If TargetDirectory is already a symbolic link to a directory, then the
ln command treats the existing target as a file. This means that a
command such as ln -fs somepath/lname symdir
will not follow the existing symbolic link of symdir, instead it will
create a new symbolic link from somepath/lname to symdir.

To create another link (alias) to a file, enter:
ln -f chap1 intro
This links chap1 to the new name, intro. If intro does not already exist,
the file name is created. If intro does exist, the file is replaced by a link
to chap1. Then both the chap1 and intro file names will refer to the same file.
Any changes made to one also appear in the other. If one file name is deleted
with the del or the rm command, the file is not completely deleted since
it remains under the other name.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top