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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How does the ln command actually work?

Status
Not open for further replies.

fretag

Instructor
Jul 28, 2000
3
US
Can anyone help me out with the link command. I have been trying to get a handle on this command and I just can't. I partially understand it's purpose, but can anyone give me a practical example that may be able to help me get past my lack of understanding? [sig][/sig]
 
hello,
with the link command you can create a file which points to an other file.
imagine you have an existing file, for example a library, /home/project1/alibrary.lib and a second project needs the same library, rather then to copy the file you can create link which takes no place on the disk.
ln /home/project1/alibrary.lib path_to_the_new_file

But if the new fle is on a different filesystem you had to use the option -s (symbolic link):
ln -s /home/project1/alibrary.lib /usr/.... (for example)

I hope I answered your question.
regards
Carine [sig][/sig]
 
That's the function: To have a file with many names, then you can have a file named /the/ver/long/path/to/a_long_file_name and use it like /afile

It's easier and convenient! [sig][/sig]
 
Carine, your example is simple and straight forward thanks for the help.

Thanks Elgis also! [sig][/sig]
 
Hello limptte,


The ln command which is used to create links between
files and directories.After creating link if u are
modifying any file second file is also updated.
that means u are manging a back up file.

ln [path]<source filename > [path]<target filename>

it create two types of links :-
1) HARD LINKS
2) SYMBOLIC LINKS
Bydefault it creates HARD LINKS.
if u want to create a symbolic link
ln -s <source file> <tagetfile>(softlink)
hard links are not visible
symbolic are visible when u are using the ls -L.
option.

And When u are using ls -F if is any link file
either sysmbolic or hard link it shows with
file name@


Note if the source file and taget files in diffrent
directries u should specify the PATH.








G.V.RAMA MOHAN
gvramohan@rediffmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top