drwxr -xr -x 2 what is the meaning of 2 [closed] - linux

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
drwxr-xr-x 2 vivekray vivekray 4096 2012-01-02 14:09 Templates
what is the meaning of 2.
if you have some time please reply me thanx.

As the other answers have explained, the number is a count of hard links to the file. However, since your "file" is a directory, the meaning is a little different than usual.
Directories in Unix-like systems always have at least two links to them. One is the directory's entry in its parent directory and the other is the "." entry in its own listing. If there are any sub-directories within a directory, each one caused an additional link to its parent from its ".." entry.
So the extra bit of info you can get from that number is that Templates has no sub-directories.

It is the number of hard links referencing that file/blob of data. The 2 means that there are two different names (Templates being one of those) for the same file.
Note that this only works for hard links and not symbolic links (links created with ln -s). Also note that the other name of that file will also have a count of 2.

It's the number of hard links to the file.

Number of links: Second field specifies the number of links for that file. In this example, 2 indicates that there are 2 links to this directory entry.

Related

Find files that have been only once modified in last 24 hours [duplicate]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
How to find the number of times particular file has been modified in given time range i.e in last 2 days in Unix client?
As seen in UNIX & Linux Stackexchange
Linux offers three timestamps for files: time of last access of
contents (atime), time of last modification of contents (mtime),
and time of last modification of the inode (metadata, ctime). So,
no, you cannot. The directory's mtime corresponds to the last file
creation or deletion that happened, though.
So you cannot know neither the creation time, neither the history of the modifications.
The linux kernel uses inode for files in filesystems these inodes do not log changes in the filesystem, you can however ask for the last change through mtime example find testfile -mtime 2 this will tell you if the file has changed in the last 48 hours.
You are looking the log changes to the file, you could use inotify for that. Or the inotifywait tool. Which let's you efficiently wait for changes in a file.
I suggest inotifywait.

How to find the number of times particular file has been modified in given time range [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
How to find the number of times particular file has been modified in given time range i.e in last 2 days in Unix client?
As seen in UNIX & Linux Stackexchange
Linux offers three timestamps for files: time of last access of
contents (atime), time of last modification of contents (mtime),
and time of last modification of the inode (metadata, ctime). So,
no, you cannot. The directory's mtime corresponds to the last file
creation or deletion that happened, though.
So you cannot know neither the creation time, neither the history of the modifications.
The linux kernel uses inode for files in filesystems these inodes do not log changes in the filesystem, you can however ask for the last change through mtime example find testfile -mtime 2 this will tell you if the file has changed in the last 48 hours.
You are looking the log changes to the file, you could use inotify for that. Or the inotifywait tool. Which let's you efficiently wait for changes in a file.
I suggest inotifywait.

NFS different permissions to subdirectories [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have the following /etc/exports config for my NFS server.
/root/share *(rw,fsid=0,no_root_squash)
/root/share/music anne(rw,no_root_squash) alex(rw,no_root_squash)
/root/share/video anne(rw,no_root_squash) alex(ro,no_root_squash)
I want anne to have rw access to both directories. I want alex to have only ro access to /root/share/video. The problem with my current config is that they both have rw access.
If I change the first line to
/root/share *(ro,fsid=0,no_root_squash)
It overwrites every other line and makes all directories read-only.
How can I make the first line take effect only on /root/share ?
Thank you.
You are very confused about what constitutes an exported filesystem. /etc/exports does not contain an Access Control List - not really. It contains a list of independent filesystems and how they should be exported.
Each entry is completely separate from each other and the export name matching is exact, not recursive - if alex mounts /root/share only the first entry will be used. In the same vein, alex cannot mount /root/share/misc directly because it is not an exported directory.

Behaviour of soft links pointing to each other in unix filesystem? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
When I made two soft links in a directory pointing to each other
eg.
abc->xyz and xyz->abc
I was not able to open that directory graphically in ubuntu.
When I clicked that dierctory it instantly opened and that gets closed immediately.
what may be the reason for that and how can it be sorted except deleting those soft links?
You probably mean circular symbolic links (or symlinks). What would you expect? Any open(2) (or others) syscall would fail with errno set to
ELOOP Too many symbolic links encountered while traversing the path.
You should remove one of the links, with the unlink(2) syscall, e.g. called by the rm command; so you could open a terminal, cd to the directory containing that mess, then
rm -v abc xyz

hardlinks in Linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
What is the size of the hardlink in Linux? Will it be the size of the inode? If I have two of them?
Thanks in advnace for any explanation, I tried to google it, but didn't find anything
A hard link reuses the inode, but requires a separate directory entry, which takes up 8 bytes plus the length of the file name in ext2. There may be other costs associated, such as when directory indexing is used, also, directories grow by entire blocks.
Think of a hard link as just another name for a file. If a file has 1000 hard links, that just means that it has 1000 different directory entries associated with it, all with potentially different names. For example, if you had 1000 different names, you would still only be one person. You'd take up the same amount of space no matter how many names you had. You'd just have a bit more paperwork for each additional name.

Resources