What are links, and how do I use them?
Just starting out using linux and i'm attempting to learn the core basics of Linux and I do believe that symbolic and hard links come under that category. So I was hoping that someone could explain and/or post an URL to somewhere that does explain. :)
TIA |
Symbolic links are kind of like shortcuts in Windows, except they are more 'real'. For example, you can cd (change directory) into a link like it's a real folder. To make symbolic links:
ln -s [file to be linked to] [link] Remember, File first, Link last. See this for more info: http://www.hmug.org/man/1/ln.html |
And in case, the man page was not clear, ln can also create hard links. If you create a hard link, say from file /dev/null to /home/some-user/null using:
ln /dev/null /home/some-user/null and then accidentally remove the file /dev/null, that one in your home directory would still work just the same. However: 1) you cant make hard links across different partitions, or harddiskes 2) you cant make hard links from directories. |
So i'm wondering, what do most people use symbolic links for? The only time i've used shortcuts in windows is on the desktop...
|
hmm, well, i use them for pointing libraries in /usr/local/lib to /usr/lib and /lib so the programs that need them work... you could aslo say link a mount such as /mnt/cdrom into /var/ftp/pub/ to give anonymous ftp users access to /mnt/cdrom
|
I use them so that I can have the same files appear in different places. For instance, I am a habitual Window Manager tester, so I have a rather odd .xinitrc setup. Basically I have a subdirectory called ~/.xscripts. In that directory I have a load of basic scripts that all follow the same basic pattern:
Code:
exec gkrellm& This is a bit of an odd setup, but it works very well and serves me just the way I want. |
All times are GMT -5. The time now is 02:31 PM. |