Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-18-2004, 12:54 PM   #1
LQ Newbie
Registered: Oct 2003
Posts: 8

Rep: Reputation: 0
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.

Old 02-18-2004, 01:03 PM   #2
LQ Guru
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
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:

Last edited by aaa; 02-18-2004 at 01:05 PM.
Old 02-18-2004, 01:11 PM   #3
Registered: Dec 2003
Location: Denmark
Distribution: Mandrake
Posts: 179

Rep: Reputation: 30
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.
Old 02-18-2004, 01:12 PM   #4
LQ Newbie
Registered: Oct 2003
Posts: 8

Original Poster
Rep: Reputation: 0
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...
Old 02-18-2004, 01:40 PM   #5
Senior Member
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 404Reputation: 404Reputation: 404Reputation: 404Reputation: 404
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
Old 02-18-2004, 06:49 PM   #6
Senior Member
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Debian + Ubuntu
Posts: 4,358

Rep: Reputation: 57
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:
exec gkrellm&
exec xmms&
exec xbindkeys &
exec Esetroot -stretch ~/files/images/backgrounds/BACKGROUND.IMAGE&
exec galeon -s&
exec root-tail -noinitial -f -g 228x90+5+5 -i 0.1 /var/log/explanations,white /var/log/cron/info,green /var/log/syslog,yellow /var/log/user.log,cyan &
exec cdde&
Obviously I change the last line. I create a symlink from my current choice to ~/.xscripts/current, and I then create a symlink from that to ~/.xinitrc. So, in short, ~/.xinitrc is a symlink of ~/.xscripts/current is a symlink of ~/.xscripts/sawfish
This is a bit of an odd setup, but it works very well and serves me just the way I want.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Preserving number of links with 'cp'. ( preserve number of links ) Devyn Linux - General 7 09-16-2005 10:07 PM
links (hard links and soft links..) sachitha Programming 1 08-10-2005 12:10 PM
Sym links and hard links akudewan Linux - Newbie 4 02-09-2005 05:08 AM
how to change relitive links to specific links? wolfe2554 Linux - General 4 07-03-2004 12:40 AM
Links Section updated - Please add your Linux links. jeremy Linux - General 2 11-24-2001 11:35 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration