Java Reference
In-Depth Information
As you can see, we have a directory with a single file in it, sample . Now
let's make a hard link to that file.
$ ln sample example
$ ls -la
total 16
drwxrwxr-x 2 mschwarz mschwarz 4096 Jul 8 10:13 .
drwx------ 50 mschwarz mschwarz 4096 Jul 8 10:11 ..
-rw-rw-r-- 2 mschwarz mschwarz 45 Jul 8 10:11 example
-rw-rw-r-- 2 mschwarz mschwarz 45 Jul 8 10:11 sample
$ cat example
This is a sample
file to demonstrate
links.
$
Notice a few things here. First, other than the size and timestamps being
the same, there is nothing obvious to show that these two files are, in fact, the
same file. Note also the number just ahead of the owning user and group
names. In the first directory listing, sample had 1 in that position; now both
sample and example have 2 . This number is the link count . It tells you how
many names are linked to the data associated with this name.
We have a couple more things to point out before we move on to soft
links, which are going to be more important for our purposes.
$ chgrp wwwdev example
$ ls -la
total 16
drwxrwxr-x 2 mschwarz mschwarz 4096 Jul 8 10:13 .
drwx------ 50 mschwarz mschwarz 4096 Jul 8 10:11 ..
-rw-rw-r-- 2 mschwarz wwwdev 45 Jul 8 10:11 example
-rw-rw-r-- 2 mschwarz wwwdev 45 Jul 8 10:11 sample
$ chmod o-r example
$ ls -la
total 16
drwxrwxr-x 2 mschwarz mschwarz 4096 Jul 8 10:13 .
drwx------ 50 mschwarz mschwarz 4096 Jul 8 10:11 ..
-rw-rw---- 2 mschwarz wwwdev 45 Jul 8 10:11 example
-rw-rw---- 2 mschwarz wwwdev 45 Jul 8 10:11 sample
$ chgrp mschwarz sample
$ ls -la
total 16
Search WWH ::




Custom Search