cancel
Showing results for 
Search instead for 
Did you mean: 

symbolic link

SOLVED
Go to solution
mehul_3
Regular Advisor

symbolic link

Kindly explain what is symbolic link and in which situation it is viable to use.
Kindly explain in simple way. We are on the verge to install SAP on OS11.31 and we need to create symbolic link for some directory.

Regards,
Mehul
13 REPLIES
Dennis Handly
Acclaimed Contributor

Re: symbolic link

A symlink allows you to use a different name to point to a file or directory.
A hardlink allows you to have a different name to a file on the same filesystem.
Create both with ln(1), with -s for symlink.
Kranti Mahmud
Honored Contributor

Re: symbolic link

Hi Mehul,

A symbolic link is a type of file that indirectly refers to ("points
to") a path name. Also known as a soft link, a symbolic link contains
a relative or absolute path name. If a symbolic link to a relative
path name is encountered during path name interpretation, the contents
of the symbolic link replaces the symbolic link component and are
expanded into the path name being interpreted. If a symbolic link to
an absolute path name is encountered, the contents of the symbolic
link replaces all components up to and including the symbolic link,
and is expanded into the remainder of the path name.

Suppose that files file1, file2, and file3 originally existed under the group PXGROUP of account DEVELOP. You have decided to move the files to the /users/denis/bin/FILES directory. To ensure that all of the applications that access those files will still function properly, you must create symbolic links to those files.

Use the NEWLINK command to create the symbolic links.

:chdir /DEVELOP/PXGROUP

:newlink ./file1, /users/denis/bin/FILES file1

:newlink ./file2, /users/denis/bin/FILES/file2

:newlink ./file3, /users/denis/bin/FILES/file3

Rgds-Kranti
Dont look BACK as U will miss something INFRONT!
Steven Schweda
Honored Contributor

Re: symbolic link

> Use the NEWLINK command to create the
> symbolic links.

Use the WHAT???

man ln
man symlink
Bart Paulusse
Respected Contributor
Solution

Re: symbolic link

Hi Mehul,

SAP uses several paths to point to the same directory, for downward compatability etc.
For instance:
/usr/sap//SYS/exe/run
and:
/sapmnt//exe
have the same files in them. In order not to waste diskspace, you can create a symbolic link named run in /usr/sap//SYS/exe/ which points to /sapmnt//exe
This way both paths reach the same files whithout having them on disk twice.
Second reason for this is that this directory contains your SAP kernel, which you will be updating every now and then. Having a symbolic link means that you have to replace your kernel files only once.

The link type is symbolic an not hard because usually, above mentioned paths reside on different file systems.

regards,
Bart
Taifur
Respected Contributor

Re: symbolic link

Hi Mehul,

Symbolic link means soft link in between directory to directory.

#ln -s x y

where x is a directory and y is another directory.

Rgds//
Taifur

Ganesan R
Honored Contributor

Re: symbolic link

Hi,

Difference between hard link and softlink(symbolic link)

File links are created using the ln command and are used to access a single file with multiple file names.
By default, the ln command creates a hard link. For example, to link the file /home/myfile with /home/linkfile, you can use following command.
ln /home/myfile /home/linkfile

After using this command, linkfile will be created and will contain the same data as myfile. On the file system level, a directory entry with the name linkfile is created, which points to the same inode used by myfile. Hard links can be created only within a file system; you cannot link directories with hard links.
To create a soft link, you use the -s option with the ln command. When creating a soft link, HP-UX creates a file entry with its own inode number in the directory area. This inode number then points to a data block that contains the file name to which the link is established. Soft links can link directories and can be used between file systems.
If you delete a file that has soft links, the links are not actually deleted, as they have their own inodes. But when you try to access a linked file for which the original file has been deleted, an error message will
be shown.
Best wishes,

Ganesh.
R.K. #
Honored Contributor

Re: symbolic link

Hi Mehul,

As said, symbolic link is used only for pointing a file/directory.

We can also use this if we are running SHORT OF SPACE.

The syntax is:
# ln -s file1 file2

Regds,
R.K.
Don't fix what ain't broke
mehul_3
Regular Advisor

Re: symbolic link

Can copy files to the link being created? how can it be used after creation? Pl explain with simple example.

thanks for all for giving explanation in a simple mannner and quick response
Ganesan R
Honored Contributor

Re: symbolic link

Hi Mehul,

Yes. You can copy the files to the link file. It is going to write on the common data blocks for both original and link files.

#ln -s ln /home/dir /home/linkdir

If you write anything on the folder /home/linkdir it is going to write on /home/dir

#cp -p /tmp/test.txt /home/linkdir
Best wishes,

Ganesh.
Bart Paulusse
Respected Contributor

Re: symbolic link

Hi Mehul,

after creation the link 'works' like a normal directory.
cp /tmp/testfile /sapmnt//exe/
and
cp /tmp/testfile2 /usr/sap/
will both result in two files called testfile and testfile2 in directory /sapmnt//exe/
When you do
cd /usr/sap/you will find that testfile and testfile2 are there as well.

regards,
Bart
Torsten.
Acclaimed Contributor

Re: symbolic link

@Kranti Mahmud:

Very bad cut'n'paste!

Source was

http://docs.hp.com/en/32650-90492/ch06s11.html

This is MPE - not HP-UX!

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Sajjad Sahir
Honored Contributor

Re: symbolic link


Dear Methul

In Unix, a file that points to another file or directory. It is used to allow a variety of sources to point to a common destination. The Windows 2000 counterpart is the "virtual directory." When URLs are redirected, it is called "URL mapping." A symbolic link is like a Windows shortcut, except that the link is an index entry in the Unix file system, whereas the shortcut is a regular Windows file.

u can use ln -s to create symbolic links

thanks and regards

Sajjad Sahir
mehul_3
Regular Advisor

Re: symbolic link

Thanks for all for giving such valuable information.

Regards,
Mehul