How to identify a link whether it is a Hardlink or Softlink


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to identify a link whether it is a Hardlink or Softlink
# 1  
Old 01-20-2011
MySQL How to identify a link whether it is a Hardlink or Softlink

i am new to UNIX environment

please tell me how to identify a link whether it is a Hardlink or Softlink ?


what is the command?

thank you all .......SmilieSmilie
# 2  
Old 01-21-2011
Code:
$ touch abc

$ ln -s abc soft_abc    # create soft link

$ ln abc hard_abc       # create hard link

$ ls -l abc
-rw-r--r-- 2 root None 0 2011-01-21 16:23 abc

$ ls -l soft_abc
lrwxrwxrwx 1 root None 3 2011-01-21 16:23 soft_abc -> abc

$ ls -l hard_abc
-rw-r--r-- 2 root None 0 2011-01-21 16:23 hard_abc

# 3  
Old 01-21-2011
hardlink and softlink are quite different in nature.

soft link is a type of disk file
hard link is a file attribute as an indication on how many directory entries ( mostly means file names ) are referencing to this file
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Debian

Hardlink on wheezy by default for usb-stick?

May somebody can give me a hint. I am still using my old squeeze and it works the way I want. But my recent post about changing the owners rights, e.g. 777 or 755 anyway, it could be 644 as well. While configuring a new pc, just by chance I discovered how to enter the BIOS. And here it comes. I... (11 Replies)
Discussion started by: 1in10
11 Replies

2. Shell Programming and Scripting

Changing inode value of a hardlink

is it possible to change the inode value/ file path of a hard link? (2 Replies)
Discussion started by: fhill2
2 Replies

3. UNIX for Dummies Questions & Answers

Softlink problem

Hi there is a file 'linkk' and i have created a softlink for it in another directory. $ pwd /home/guest/khare $ ln -s linkk /home/guest/khare/AWK/done now under AWk dir i can see that the softlink is created. $ pwd /home/guest/khare/AWK $ ls -lrt *done lrwxr-xr-x 1 khare... (2 Replies)
Discussion started by: scriptor
2 Replies

4. Shell Programming and Scripting

Softlink directory name not working on SUN

I am facing a peculiar problem on SUN machine. There is a soft link pointing to a directory. And there is a shell script inside this soft link which is trying to get the directory name from where this script is being executed. NAME="$(cd $(dirname $0); pwd)" I want to fetch the... (1 Reply)
Discussion started by: Tirthankar
1 Replies

5. UNIX for Dummies Questions & Answers

Softlink Issue

Hi, We have a directory /oracle/UD1/sapdata1,since sapdata1 had no space we created a directory under /oracle/UD1/orarch/sapdata1 and soft linked /oracle/UD1/sapdata1 to /oracle/UD1/orarch/sapdata1 . Is there any way I can see if the files are being actually written to... (4 Replies)
Discussion started by: buddy1
4 Replies

6. Solaris

solaris 10- cant create softlink

bash-3.00# ln -s /lib /usr/lib ln: cannot create /usr/lib/lib: File exists bash-3.00# (4 Replies)
Discussion started by: incredible
4 Replies

7. Filesystems, Disks and Memory

Recreating a deleted hardlink to a file if I know the inode number

At risk of twisting the rules to nearly the point of breaking (if you think this goes too far mods, I apologise and accept that this should be deleted), I'm hoping someone might be able to cast a little light on the following problem regarding hard links to files. ... (6 Replies)
Discussion started by: Smiling Dragon
6 Replies

8. Solaris

Creating a hardlink to a file

I'm trying to relink a file someone tried to delete while a process (that we don't want to shutdown) also had a filehandle open to it. Consequently, we've got an inode entry but no directory entry (aka 'file') for it. I've tracked the inode number down via lsof, as well as the particular... (0 Replies)
Discussion started by: Smiling Dragon
0 Replies

9. AIX

remove hardlink directory

I have to move a lpar from one 671 to another (aix 5.2 ML 07) when I run mksysb, It alway hangs with "archieving file list" I've tried to exlude every directory, but still not working the only thing that can be a problem, is a hardlink directory normally it should not be possible to... (4 Replies)
Discussion started by: funksen
4 Replies

10. UNIX for Dummies Questions & Answers

Questions on PATH env havinf softlink

I have a question regarding the PATH environment on SunOS. I am setting the PATH as - export PATH=$PATH:/bin and /bin has a softlink as lrwxrwxrwx 1 root root 9 Oct 1 2004 /bin -> ./usr/bin So, will this path will work for the bin having the softlink? Thanks for... (1 Reply)
Discussion started by: xgr3
1 Replies
Login or Register to Ask a Question