Like Tree1Likes
  • 1 Post By brewbuck

Question about ls -l command!!!

This is a discussion on Question about ls -l command!!! within the Linux Programming forums, part of the Platform Specific Boards category; Hi All, While doing ls -l in linux prompt , it displays in the format permission no.of-links user owner no.of-bytes ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    12

    Question about ls -l command!!!

    Hi All,
    While doing ls -l in linux prompt , it displays in the format permission no.of-links user owner no.of-bytes date time name
    I have doubt in no.of-links.Actually empty directory contains 2 links and ordinary files contain 1 link.
    Why it does act like this?What are the links?
    Could anybody explain this little briefly?

    Thanks,
    Rajisankar.
    Last edited by Salem; 06-10-2011 at 02:54 AM. Reason: Inappropriate tags removed

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,274
    A directory always has at least two links: it links to itself (the "." entry in every directory is a reference to itself). There is also a link due to the parent directory which contains the directory. A file has at least one link, for the directory entry which references it.

    A "link" in this case is not a symbolic link. A link is a mapping from a directory entry to an inode. The number of links to an inode is counted within the inode itself -- this is the number which "ls" is reporting. A link count is always at least 1. A link count of 0 would indicate filesystem corruption.

    Basically it's the number of "pointers" which are "pointing at" the inode.
    rags_to_riches likes this.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    12
    Quote Originally Posted by brewbuck View Post
    A directory always has at least two links: it links to itself (the "." entry in every directory is a reference to itself). There is also a link due to the parent directory which contains the directory. A file has at least one link, for the directory entry which references it.

    A "link" in this case is not a symbolic link. A link is a mapping from a directory entry to an inode. The number of links to an inode is counted within the inode itself -- this is the number which "ls" is reporting. A link count is always at least 1. A link count of 0 would indicate filesystem corruption.

    Basically it's the number of "pointers" which are "pointing at" the inode.
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question regarding command prompt's look
    By Helgso in forum C++ Programming
    Replies: 13
    Last Post: 12-10-2008, 07:40 PM
  2. Question on 'top' command
    By muthus in forum Linux Programming
    Replies: 3
    Last Post: 01-21-2008, 01:18 AM
  3. Command Line Question
    By Sebastiani in forum C++ Programming
    Replies: 5
    Last Post: 07-09-2002, 02:46 AM
  4. Command question:
    By Gamma in forum C++ Programming
    Replies: 2
    Last Post: 04-13-2002, 07:39 PM
  5. question about those command thngy's
    By face_master in forum C++ Programming
    Replies: 4
    Last Post: 09-15-2001, 09:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21