A hard link is a link in the same filesystem with two i-node table entries pointing to the same physical contents (with the same i-node number because they point to the same data). If you want to see the effect of a link on the i-node table, display the i-node entry for a file in a directory, for example:
Then, create a link to another filename and display the i-node entries again:
As you can see, both file i-node numbers are the same. A directory listing of the two files shows that they have their own permissions and ownerships. The only thing indicating a link is the second column of the ls output, which shows a two for the number of links. Deleting a linked filename doesn't delete the file until there are no more links to it.
A symbolic link is another type of link that doesn't use the i-node entry for the link. The -s option to the ln command creates a symbolic link. For example, you can recreate the preceding example with a symbolic link:
As you can see, the i-node table entries are different. A directory listing shows the symbolic link as an arrow:
The file permissions for a symbolic link are always set to lrwxrwxrwx. Permissions for access to the symbolic link name are determined by the permissions and ownership of the file it is symbolically linked to (bigfile in this case).
The difference between hard links and symbolic links is more than just i-node table entries.Unlike hard links (hard link is not allowed for directory and across different filesysems), symbolic links can be made to directories or across file systems with no restrictions. You can create symbolic links to files that don't exist yet(Opening this link will fail until a file by that name is created ), which you can't do with hard links. You can also follow symbolic links to find out what they point to, which is an almost impossible task with hard links. The kernel processes the two types of links differently, too.
Neo's example shows the importance and easiness of links.
PS: it's not just shortcuts; it's the standard way to link files and directories in unix.
Last edited by Yogesh Sawant; 11-09-2010 at 07:36 AM..
Reason: added code tags, and some spelling corrections
i just installed netBSD, and i want to know how to create a new user account. i understand that netBSD doesn't come with the tools to do that, so i downloaded a user utility (mebbe i'm wrong about netBSD) but the problem is, i don't know how to read files off floppy disks. (i'm quite new to unix)... (3 Replies)
I have AIX 5.1
I have created a user manually in the /etc directory.
Then I created his home directory "mkdir /home/fharvey"
then I changed ownership "chown fharvey /home/fharvey"
set his password "passwd fharvey"
When I log in as him I get "user is required to change password. "when I... (7 Replies)
Hi all,
I am a newbe to aix 5.2. I want to specify the characters used by users while creating user in aix like specifying the length of the password
should i use some sript for that if it is then please let me know how to do this
if yes give me the link for the scripts.
Thanks in advance
... (2 Replies)
Hey everyone I am new to the forums and to Unix. I am currently taking a class on Unix, our teacher posed the question to us How do u create a user account without using GUI or command? We are currently running Knoppix version of Unix and for the life of me I can't figure out how this is possible.... (0 Replies)
Hi,
I have written a program using shell scripting. When you run the file it will asks you to enter the user name, if the user exists it says " user exists " if not it will displays like " user doesnt exist" and then asks you like " do you want to add user with options Yes or No " if you say... (1 Reply)
Hi all,
I logged in as root in solaris machine and made an attempt to create a user ,i am getting the following error message pls help me to resolve this issue
bash-3.00# useradd -d /home/kalyan -m -s /bin/sh kalyan
UX: useradd: ERROR: Unable to create the home directory: Operation not... (2 Replies)
How do I create shortcuts? For example:
I just want to type one key "l" and have it output the command of "ls -lah"
I believe it's creating a file called l with 755 permissions but I'm not sure where to put the file.
*if it matters, I'm on a shared hosting web server using cPanel with... (2 Replies)
Hi, I want to match a column of one file with many others and take the average of each one and put them into one file (I know sounds complicated).
so the 1st file is just a list of names that I want to match with the 2nd file that have names along with rows of values.
awk... (4 Replies)
Hello All,
I just created a new user on a server running SLES 11, and I created the user using the command below:
# useradd -G nagios scpuser
But whenever I create a file or directory while logged in as this user it creates the file's ownership permissions as "scpuser:users"
instead of it... (2 Replies)
Hi Experts,
Need your support
Redhat 6.5
I want to create a user with all(read, write, execute) privileges except that user should not be able to create any new user from his login
to perform any task. (10 Replies)