Showing results for 
Search instead for 
Did you mean: 

Re: ln command

Go to solution
Super Advisor

ln command

how do i do a link??
how do i use ln command??

for doing something like this one (where appears "->" ):
lrwxrwxrwx 1 root sys 18 Nov 24 2001 global -> /sapmnt/CP1/global
lrwxrwxrwx 1 root sys 19 Nov 24 2001 profile -> /sapmnt/CP1/profile

Super Advisor

Re: ln command


someting like
ln -s /sapmnt/CP1/global global

take a look in man :)
Honored Contributor

Re: ln command


if you are looking for the C-interface:
man symlink

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Honored Contributor

Re: ln command

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.

for more information please visit the below link.

Asif Sharif

Asif Sharif
Frequent Advisor

Re: ln command


Best way is check for Manpage for "ln".

There are two ways for that:
"ln" (Hardlink) and "ln -s" (soft Link).

In your case it should be like this:

ln -s global /sapmnt/CP1/global
ln -s profile /sapmnt/CP1/profile

Hope this will answer your question.
Acclaimed Contributor

Re: ln command

If you are lazy, you don't have to repeat the name twice. From Maxim's example:
ln -s /sapmnt/CP1/global .

Note: Samir's example is backwards.

One point about symlinks, if you want them to work over NFS, you should make them self relative. The above link would only work if /sapmnt was also mounted on the client.

If you were in /sapmnt/CP2, you would use:
ln -s ../CP1/global .
Trusted Contributor

Re: ln command


I always think of the -s as source. Just helps me remember. So

ln -s /var/tmp/mysourcefile /var/tmp/mylinkfile

would create the link /var/tmp/mylinkfile to the source file /var/tmp/mysourcefile.

A long listing in /var/tmp would show

mylinkfile -> /var/tmp/mysourcefile