cancel
Showing results for 
Search instead for 
Did you mean: 

Re: ln command

 
SOLVED
Go to solution
Highlighted
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

THANKS ...
6 REPLIES 6
Highlighted
Super Advisor
Solution

Re: ln command

Hi

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

take a look in man :)
Highlighted
Honored Contributor

Re: ln command

Hi,

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"
Highlighted
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.

http://docs.hp.com/en/B2355-90689/ln.1.html

Regards,
Asif Sharif

Regards,
Asif Sharif
Highlighted
Frequent Advisor

Re: ln command

Hi,

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.
Highlighted
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 .
Highlighted
Trusted Contributor

Re: ln command

Manuales,

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

HTH,

Berd