LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Understanding shell (https://www.linuxquestions.org/questions/linux-newbie-8/understanding-shell-208177/)

foo_mulan 07-22-2004 02:55 AM

Understanding shell
 
Hi! I was looking at a manual on how to install Apache, MySQL and PHP on Linux. Can someone explain to me what these lines mean? I would like to further understand the commands.

#cd /etc/rc3.d
#ln -s ../init.d/mysql S85mysql
#ln -s ../init.d/mysql K85mysql
#cd /etc/rc5.d
#ln -s ../init.d/mysql S85mysql
#ln -s ../init.d/mysql K85mysql
#cd ../init.d
#chmod 755 mysql

Thank you very much.

Ztyx 07-22-2004 03:16 AM

Have a look at
Code:

# man ln
The command 'ln' is used to create a symlink. A symlink is somewhat what in windows is called a 'shortcut'. The '-s' flag creates a soft symlink, which is normally what you use when you want to create one.
The command
Code:

#ln -s ../init.d/mysql S85mysql
creates a symlink called 'S85mysql' (put into the '/etc/rc5.d' folder) which is refering to the actual file '../init.d/mysql'.

For chmod yoiu can have a look at this homepage:
http://catcode.com/teachmod/

Regards,

Jens

AnanthaP 07-22-2004 09:23 AM

Actually, the "link" command is far superior to a "shortcut". It actually creates a second entry in the directory entry with the same "-i-node" (pointer to the file). So while changes in one file get reflected in the linked one also (as you might expect), when you are done with the fisrt entry, you can delete it while the file would still exist under the second name. In the case of a 'shortcut", the shortcut would cease to work.

All Unixes (includiing Linux) have various run levels. 0 - single user to 5 (GUI - I think). The parameters in /etc/rc?.d (? ranging from 2 to 5), contain the parameters that will be used to rebuild the "kernel".

Unlike DOS, which relies on the extension (like EXE, COM, pdf, doc) to tell the nature of the file, Unix relies on the permission "mode" thus "chmod" for change mode.

End

Ztyx 07-23-2004 02:36 PM

Quote:

Originally posted by AnanthaP
Actually, the "link" command is far superior to a "shortcut". It actually creates a second entry in the directory entry with the same "-i-node" (pointer to the file). So while changes in one file get reflected in the linked one also (as you might expect), when you are done with the fisrt entry, you can delete it while the file would still exist under the second name. In the case of a 'shortcut", the shortcut would cease to work.

...now I got curious here. What you are talking about is a hard symlink aren't you? His example were creating soft symlinks. There is a difference. A hard link can only refer to a file on the same partition since it points to a certain i-node and also increments a counter so that the fs knows that there are actually two file pointing at the same segment on i.e. a haddrive. That way when one of the files are removed it knows that there is still another file pointing at the segment.
But the thing is that a soft symlink is created more like in windows (apart from as you said that it's not a file - the referens to the file it's pointing to is saved in the directory file instead) - it is just a plain file which is pointing to a location in the UNIX filesystem i.e.
'/etc/lilo.conf'. That is why a soft link stops to work after you've removed the file they are pointing to.

For a newbie I normally skip the hard link discussions, because usually the soft ones works perfectly thrueout the systems because most knows that if you delete source file the symlink stops to work and that's the only problem. Hardlinks are more important if one is working with links to library files or big very important files...in my opinion.

Ciao,

/J


All times are GMT -5. The time now is 07:49 AM.