General
cancel
Showing results for 
Search instead for 
Did you mean: 

whats the purpose of using links?

Beginner_2
Occasional Advisor

whats the purpose of using links?

in what situations one as to use links(hard/soft).

ans to X person: i asked this question here more bcoz to know purpose of using it..i did web search but some detail and understandable info abt links thats why askd here.. rather than discouraging people better focus on helpping people.......it wil be better for u
6 REPLIES
Elmar P. Kolkman
Honored Contributor

Re: whats the purpose of using links?

Most important reason for using links: save diskspace. A link is only a pointer to the real data, a copy consists of the data itself.

But there are lots of other reasons too...

For instance: you have software installed with a version 8.11.0 in a directory called /distr/rubbish-8.11.0. If you now make a symlink to it called /distr/rubbish, you can access the software through that symlink. If a patch is installed, the new version installs in /distr/rubbish-8.11.5. By redirecting the symlink to that new version, you still access it through /distr/rubbish, but now run the new version.

Other trick is having an executable determine its default behaviour not through flags but be the name it is used by (for instance grep/egrep/fgrep/...).

So you see, it depends on the needs...
Every problem has at least one solution. Only some solutions are harder to find.
bullz
Super Advisor

Re: whats the purpose of using links?

Haa well named "Beginner" and posting apt questions....

U can get simple and well explained details wen u dig it in google

* Something like shortcut in windows...!
* Pointing one file to other location (same as above command :))
* U learn it better, once use the commna for the actual usage...

Good luck dued....
Steven Schweda
Honored Contributor

Re: whats the purpose of using links?

> ans to X person: [...]

This might make more sense in your earlier
thread:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1435294

Why start a new thread on the same subject?

> [...] it wil be better for u

> Jun 16, 2010 14:43:21 GMT 4 pts

Apparently not much better.

> whats the purpose of using links?

To let you use more than one name (or path)
to get to one file.

> in what situations one as to use
> links(hard/soft).

One uses them when they do what one wants.
What do you want to do?
Alzhy
Honored Contributor

Re: whats the purpose of using links?

"links" are used to portray "simpler" or "alternate" names to actual files (or devices).

For instance:

Say you have a file whose complete path is:

/a/b/c/d/e/f/file.txt

And say your home directory is /home/beg.

You can create a link under /home/beg say named data.txt but it is actually a link to /a/b/c/d/e/f/file.txt using the command:

ln -s home/beg/data.txt /a/b/c/d/e/f/file.txt


So you need not navigate that deep directory path to view that file.

Other situations:

/oradata/SAPdata01.dbf -> /dev/vgSAPdata/lvSAPdata01

(So instead of referring the raw device path to Oracle, you use a link with simpler. shorter names).



Hakuna Matata.
Alzhy
Honored Contributor

Re: whats the purpose of using links?

Correction:

ln -s /a/b/c/d/e/f/file.txt /home/beg/data.txt
Hakuna Matata.
dirk dierickx
Honored Contributor

Re: whats the purpose of using links?

imagine you have this file prog.conf, and all your users use it and you want them to use this configuration you prepared.

you could do 2 things, copy prog.conf to all the users home. this works, but then you change the configuration and have to copy this file again to all users, what a waste of time.
instead you put links to this file in each users home dir, and when you have to make changes, you only do this once and the links will still point to your file and thus your changes.

imagine you have this program /opt/application, it keeps his logs in /opt/application/logs. you don't want this, because /opt should have a steady size and logs normally go into /var. unlucky for you, there is no option to change the log location for this app. what to do? allow /opt to run full? no, you create a link from /var/opt/application to /opt/application/logs and now your logs are in /var.

there are more uses and neat tricks to play with links, i'll leave it up to you to find others...