How to create a link from a directory to another directory

If you want files to appear in one directory while you put them in another directory, you can create a link between these directories.

Procedure:

Go in the directory in which you want to have the new linked directory. Type in the following command:
ln -s [source] [target]
The blanks in between are important. Both, source and target, can be directories. If the source directory is somewhere else, you have to type in the whole path.
Important: The target directory must not exist while creating the link!
The new directory does not exist physically, it is just a symbolic link, but it is accessible and all files, you put in the source directory, will appear in it, too.


To check the link:
ls -l
To remove the link:
rm [target]

 

link to a file under UNIX



> But please explain to me next time how to do this. Since I have no
> time to read man I would like if you give me directions how to do
> this in general under Unix.

In order to make a link to a file under UNIX, you type:

   ln existing-file new-link

where "existing-file" is the filename of the existing file, and "new-link"
is the name of the new filename. The way it works, is you need to think
of the file as one thing, and the name as something used to refer to it.
The file can have more than one name. You can do anything through both
filenames, and deleting one filename only removes that name, not the file
itself. Only when there are no names for a file is the file deleted.