What does the number after Unix/Linux file permissions like “-rw-rw-r--. 1 ” mean in “ls -l” output












11















Can any one explain -rw-rw-r--. 1 and give some "detailed" information on ls -lart command.



Specifically, what does the number 1 after the file permissions mean?
Why does it change or why is it different for different files?










share|improve this question















migrated from stackoverflow.com Sep 21 '12 at 9:59


This question came from our site for professional and enthusiast programmers.














  • 3





    en.wikipedia.org/wiki/…

    – Karoly Horvath
    Sep 21 '12 at 10:03






  • 1





    Have you tried finding information yourself (manual pages, etc.)? Was the information unclear?

    – Daniel Andersson
    Sep 21 '12 at 10:14











  • @yi_H, I don't see any information on the number after the permissions.

    – Shahbaz
    Sep 21 '12 at 10:25











  • I was sure user1688102's question had already been asked and answered but can't find it. @Shahbaz: it;s the number of references to the same inode, i.e. the number of hard-links, i.e. the number of different names for the same file (excluding soft-links).

    – RedGrittyBrick
    Sep 21 '12 at 10:40













  • I've seen the man ls page. The information was not clear and no information was provided regarding permissions in man ls @Daniel

    – VAR121
    Sep 21 '12 at 12:03


















11















Can any one explain -rw-rw-r--. 1 and give some "detailed" information on ls -lart command.



Specifically, what does the number 1 after the file permissions mean?
Why does it change or why is it different for different files?










share|improve this question















migrated from stackoverflow.com Sep 21 '12 at 9:59


This question came from our site for professional and enthusiast programmers.














  • 3





    en.wikipedia.org/wiki/…

    – Karoly Horvath
    Sep 21 '12 at 10:03






  • 1





    Have you tried finding information yourself (manual pages, etc.)? Was the information unclear?

    – Daniel Andersson
    Sep 21 '12 at 10:14











  • @yi_H, I don't see any information on the number after the permissions.

    – Shahbaz
    Sep 21 '12 at 10:25











  • I was sure user1688102's question had already been asked and answered but can't find it. @Shahbaz: it;s the number of references to the same inode, i.e. the number of hard-links, i.e. the number of different names for the same file (excluding soft-links).

    – RedGrittyBrick
    Sep 21 '12 at 10:40













  • I've seen the man ls page. The information was not clear and no information was provided regarding permissions in man ls @Daniel

    – VAR121
    Sep 21 '12 at 12:03
















11












11








11


3






Can any one explain -rw-rw-r--. 1 and give some "detailed" information on ls -lart command.



Specifically, what does the number 1 after the file permissions mean?
Why does it change or why is it different for different files?










share|improve this question
















Can any one explain -rw-rw-r--. 1 and give some "detailed" information on ls -lart command.



Specifically, what does the number 1 after the file permissions mean?
Why does it change or why is it different for different files?







linux unix permissions ls






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 13 '18 at 21:41









Patrick M

204411




204411










asked Sep 21 '12 at 9:56









VAR121VAR121

65113




65113




migrated from stackoverflow.com Sep 21 '12 at 9:59


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Sep 21 '12 at 9:59


This question came from our site for professional and enthusiast programmers.










  • 3





    en.wikipedia.org/wiki/…

    – Karoly Horvath
    Sep 21 '12 at 10:03






  • 1





    Have you tried finding information yourself (manual pages, etc.)? Was the information unclear?

    – Daniel Andersson
    Sep 21 '12 at 10:14











  • @yi_H, I don't see any information on the number after the permissions.

    – Shahbaz
    Sep 21 '12 at 10:25











  • I was sure user1688102's question had already been asked and answered but can't find it. @Shahbaz: it;s the number of references to the same inode, i.e. the number of hard-links, i.e. the number of different names for the same file (excluding soft-links).

    – RedGrittyBrick
    Sep 21 '12 at 10:40













  • I've seen the man ls page. The information was not clear and no information was provided regarding permissions in man ls @Daniel

    – VAR121
    Sep 21 '12 at 12:03
















  • 3





    en.wikipedia.org/wiki/…

    – Karoly Horvath
    Sep 21 '12 at 10:03






  • 1





    Have you tried finding information yourself (manual pages, etc.)? Was the information unclear?

    – Daniel Andersson
    Sep 21 '12 at 10:14











  • @yi_H, I don't see any information on the number after the permissions.

    – Shahbaz
    Sep 21 '12 at 10:25











  • I was sure user1688102's question had already been asked and answered but can't find it. @Shahbaz: it;s the number of references to the same inode, i.e. the number of hard-links, i.e. the number of different names for the same file (excluding soft-links).

    – RedGrittyBrick
    Sep 21 '12 at 10:40













  • I've seen the man ls page. The information was not clear and no information was provided regarding permissions in man ls @Daniel

    – VAR121
    Sep 21 '12 at 12:03










3




3





en.wikipedia.org/wiki/…

– Karoly Horvath
Sep 21 '12 at 10:03





en.wikipedia.org/wiki/…

– Karoly Horvath
Sep 21 '12 at 10:03




1




1





Have you tried finding information yourself (manual pages, etc.)? Was the information unclear?

– Daniel Andersson
Sep 21 '12 at 10:14





Have you tried finding information yourself (manual pages, etc.)? Was the information unclear?

– Daniel Andersson
Sep 21 '12 at 10:14













@yi_H, I don't see any information on the number after the permissions.

– Shahbaz
Sep 21 '12 at 10:25





@yi_H, I don't see any information on the number after the permissions.

– Shahbaz
Sep 21 '12 at 10:25













I was sure user1688102's question had already been asked and answered but can't find it. @Shahbaz: it;s the number of references to the same inode, i.e. the number of hard-links, i.e. the number of different names for the same file (excluding soft-links).

– RedGrittyBrick
Sep 21 '12 at 10:40







I was sure user1688102's question had already been asked and answered but can't find it. @Shahbaz: it;s the number of references to the same inode, i.e. the number of hard-links, i.e. the number of different names for the same file (excluding soft-links).

– RedGrittyBrick
Sep 21 '12 at 10:40















I've seen the man ls page. The information was not clear and no information was provided regarding permissions in man ls @Daniel

– VAR121
Sep 21 '12 at 12:03







I've seen the man ls page. The information was not clear and no information was provided regarding permissions in man ls @Daniel

– VAR121
Sep 21 '12 at 12:03












3 Answers
3






active

oldest

votes


















14














Some examples:



-rwxrw-r-- 1 is a file with read, write and execute privileges for the owner. The group has read and write, and others have only read. There are no links to this data.



drwxr-xr-x 10 is a directory with 8 files. The extra 2 are . and ... Only the owner can create files in this directory, others can access which files are in the directory, and read the contents of those files if the privileges allow.



-r-------- 2 is a file which only the owner can read, but cannot execute or modify. It has a link, which means there is another file reference on disk somewhere that accesses the same data. So the actual "file content" on disk has 2 "files" referencing it. These links are often created using ln without supplying -s.



So:




  • Character 1 is node type: commonly - or d indicating file or directory.

  • Characters 2, 3, 4 indicate read, write, and execute for the owner.

  • Characters 5, 6, 7 do the same for the group.

  • Characters 8, 9, 10 do the same for others.

  • The number succeeding permission characters indicates the number of links if the node is a file, and number of "sub-nodes" if the node is a directory.


See chapter The Long Format of man ls.






share|improve this answer
























  • As @sapht said the number(for a directory) at the end implies the number of files in a directory is wrong I guess. Because I have thousands of files in directory and it is still showing 2

    – VAR121
    Sep 21 '12 at 12:08











  • I've never seen an ls that doesn't print directory subnode count using long format. Which OS/distribution are you on? Gnu ls, , busybox and darwin all print the node count. Is it really a directory and not another node type?

    – sapht
    Sep 21 '12 at 15:17



















1














In short: It is the number of hard-links to the contents of the file. 1 means no hard-links, 2 means this and another filename share the same contents, etc.



For directories most but not all filesystems report a link count of 2+nr_of_subdirs (for more info read this)






share|improve this answer

































    0














    [max@localhost ~]$ ll



    total 4



    drwxrwxr-x 2 max max 4096 Sep 25 17:11 zzz



    Here 2 means number of link count



    now I will create 3 directories inside zzz



    now value changes to 5




    [max@localhost ~]$ cd zzz
    [max@localhost zzz]$ mkdir a b c
    drwxrwxr-x 5 max max 4096 Sep 25 17:16 .
    drwx------ 5 max max 4096 Sep 25 17:12 ..
    drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
    drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
    drwxrwxr-x 2 max max 4096 Sep 25 17:16 c


    [max@localhost zzz]$ cd



    [max@localhost ~]$ ll



    total 4



    drwxrwxr-x 5 max max 4096 Sep 25 17:16 zzz



    That is because now 5 directories are present inside zzz 3 are a b c and 2 are hidden directories . ..



    if I create file then nothing will happen to link count




    [max@localhost zzz]$ touch 1 2 3
    [max@localhost zzz]$ ls -al
    total 20
    drwxrwxr-x 5 max max 4096 Sep 25 17:26 . ------> current directory link count
    drwx------ 5 max max 4096 Sep 25 17:12 .. ------> parent directory link count
    -rw-rw-r-- 1 max max 0 Sep 25 17:26 1
    -rw-rw-r-- 1 max max 0 Sep 25 17:26 2
    -rw-rw-r-- 1 max max 0 Sep 25 17:26 3
    drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
    drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
    drwxrwxr-x 2 max max 4096 Sep 25 17:16 c
    [max@localhost zzz]$ cd
    [max@localhost ~]$ ll
    total 4
    drwxrwxr-x 5 max max 4096 Sep 25 17:26 zzz



    but if I delete any directory then link count will change




    [max@localhost zzz]$ rmdir b c
    [max@localhost zzz]$ cd
    [max@localhost ~]$ ll
    total 4
    drwxrwxr-x 3 max max 4096 Sep 25 17:28 zzz





    share|improve this answer
























    • Much (maybe too much) detail for dirs not a word for files.

      – ndemou
      Jan 16 at 16:26











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f477858%2fwhat-does-the-number-after-unix-linux-file-permissions-like-rw-rw-r-1-mea%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    14














    Some examples:



    -rwxrw-r-- 1 is a file with read, write and execute privileges for the owner. The group has read and write, and others have only read. There are no links to this data.



    drwxr-xr-x 10 is a directory with 8 files. The extra 2 are . and ... Only the owner can create files in this directory, others can access which files are in the directory, and read the contents of those files if the privileges allow.



    -r-------- 2 is a file which only the owner can read, but cannot execute or modify. It has a link, which means there is another file reference on disk somewhere that accesses the same data. So the actual "file content" on disk has 2 "files" referencing it. These links are often created using ln without supplying -s.



    So:




    • Character 1 is node type: commonly - or d indicating file or directory.

    • Characters 2, 3, 4 indicate read, write, and execute for the owner.

    • Characters 5, 6, 7 do the same for the group.

    • Characters 8, 9, 10 do the same for others.

    • The number succeeding permission characters indicates the number of links if the node is a file, and number of "sub-nodes" if the node is a directory.


    See chapter The Long Format of man ls.






    share|improve this answer
























    • As @sapht said the number(for a directory) at the end implies the number of files in a directory is wrong I guess. Because I have thousands of files in directory and it is still showing 2

      – VAR121
      Sep 21 '12 at 12:08











    • I've never seen an ls that doesn't print directory subnode count using long format. Which OS/distribution are you on? Gnu ls, , busybox and darwin all print the node count. Is it really a directory and not another node type?

      – sapht
      Sep 21 '12 at 15:17
















    14














    Some examples:



    -rwxrw-r-- 1 is a file with read, write and execute privileges for the owner. The group has read and write, and others have only read. There are no links to this data.



    drwxr-xr-x 10 is a directory with 8 files. The extra 2 are . and ... Only the owner can create files in this directory, others can access which files are in the directory, and read the contents of those files if the privileges allow.



    -r-------- 2 is a file which only the owner can read, but cannot execute or modify. It has a link, which means there is another file reference on disk somewhere that accesses the same data. So the actual "file content" on disk has 2 "files" referencing it. These links are often created using ln without supplying -s.



    So:




    • Character 1 is node type: commonly - or d indicating file or directory.

    • Characters 2, 3, 4 indicate read, write, and execute for the owner.

    • Characters 5, 6, 7 do the same for the group.

    • Characters 8, 9, 10 do the same for others.

    • The number succeeding permission characters indicates the number of links if the node is a file, and number of "sub-nodes" if the node is a directory.


    See chapter The Long Format of man ls.






    share|improve this answer
























    • As @sapht said the number(for a directory) at the end implies the number of files in a directory is wrong I guess. Because I have thousands of files in directory and it is still showing 2

      – VAR121
      Sep 21 '12 at 12:08











    • I've never seen an ls that doesn't print directory subnode count using long format. Which OS/distribution are you on? Gnu ls, , busybox and darwin all print the node count. Is it really a directory and not another node type?

      – sapht
      Sep 21 '12 at 15:17














    14












    14








    14







    Some examples:



    -rwxrw-r-- 1 is a file with read, write and execute privileges for the owner. The group has read and write, and others have only read. There are no links to this data.



    drwxr-xr-x 10 is a directory with 8 files. The extra 2 are . and ... Only the owner can create files in this directory, others can access which files are in the directory, and read the contents of those files if the privileges allow.



    -r-------- 2 is a file which only the owner can read, but cannot execute or modify. It has a link, which means there is another file reference on disk somewhere that accesses the same data. So the actual "file content" on disk has 2 "files" referencing it. These links are often created using ln without supplying -s.



    So:




    • Character 1 is node type: commonly - or d indicating file or directory.

    • Characters 2, 3, 4 indicate read, write, and execute for the owner.

    • Characters 5, 6, 7 do the same for the group.

    • Characters 8, 9, 10 do the same for others.

    • The number succeeding permission characters indicates the number of links if the node is a file, and number of "sub-nodes" if the node is a directory.


    See chapter The Long Format of man ls.






    share|improve this answer













    Some examples:



    -rwxrw-r-- 1 is a file with read, write and execute privileges for the owner. The group has read and write, and others have only read. There are no links to this data.



    drwxr-xr-x 10 is a directory with 8 files. The extra 2 are . and ... Only the owner can create files in this directory, others can access which files are in the directory, and read the contents of those files if the privileges allow.



    -r-------- 2 is a file which only the owner can read, but cannot execute or modify. It has a link, which means there is another file reference on disk somewhere that accesses the same data. So the actual "file content" on disk has 2 "files" referencing it. These links are often created using ln without supplying -s.



    So:




    • Character 1 is node type: commonly - or d indicating file or directory.

    • Characters 2, 3, 4 indicate read, write, and execute for the owner.

    • Characters 5, 6, 7 do the same for the group.

    • Characters 8, 9, 10 do the same for others.

    • The number succeeding permission characters indicates the number of links if the node is a file, and number of "sub-nodes" if the node is a directory.


    See chapter The Long Format of man ls.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 21 '12 at 10:05









    saphtsapht

    24017




    24017













    • As @sapht said the number(for a directory) at the end implies the number of files in a directory is wrong I guess. Because I have thousands of files in directory and it is still showing 2

      – VAR121
      Sep 21 '12 at 12:08











    • I've never seen an ls that doesn't print directory subnode count using long format. Which OS/distribution are you on? Gnu ls, , busybox and darwin all print the node count. Is it really a directory and not another node type?

      – sapht
      Sep 21 '12 at 15:17



















    • As @sapht said the number(for a directory) at the end implies the number of files in a directory is wrong I guess. Because I have thousands of files in directory and it is still showing 2

      – VAR121
      Sep 21 '12 at 12:08











    • I've never seen an ls that doesn't print directory subnode count using long format. Which OS/distribution are you on? Gnu ls, , busybox and darwin all print the node count. Is it really a directory and not another node type?

      – sapht
      Sep 21 '12 at 15:17

















    As @sapht said the number(for a directory) at the end implies the number of files in a directory is wrong I guess. Because I have thousands of files in directory and it is still showing 2

    – VAR121
    Sep 21 '12 at 12:08





    As @sapht said the number(for a directory) at the end implies the number of files in a directory is wrong I guess. Because I have thousands of files in directory and it is still showing 2

    – VAR121
    Sep 21 '12 at 12:08













    I've never seen an ls that doesn't print directory subnode count using long format. Which OS/distribution are you on? Gnu ls, , busybox and darwin all print the node count. Is it really a directory and not another node type?

    – sapht
    Sep 21 '12 at 15:17





    I've never seen an ls that doesn't print directory subnode count using long format. Which OS/distribution are you on? Gnu ls, , busybox and darwin all print the node count. Is it really a directory and not another node type?

    – sapht
    Sep 21 '12 at 15:17













    1














    In short: It is the number of hard-links to the contents of the file. 1 means no hard-links, 2 means this and another filename share the same contents, etc.



    For directories most but not all filesystems report a link count of 2+nr_of_subdirs (for more info read this)






    share|improve this answer






























      1














      In short: It is the number of hard-links to the contents of the file. 1 means no hard-links, 2 means this and another filename share the same contents, etc.



      For directories most but not all filesystems report a link count of 2+nr_of_subdirs (for more info read this)






      share|improve this answer




























        1












        1








        1







        In short: It is the number of hard-links to the contents of the file. 1 means no hard-links, 2 means this and another filename share the same contents, etc.



        For directories most but not all filesystems report a link count of 2+nr_of_subdirs (for more info read this)






        share|improve this answer















        In short: It is the number of hard-links to the contents of the file. 1 means no hard-links, 2 means this and another filename share the same contents, etc.



        For directories most but not all filesystems report a link count of 2+nr_of_subdirs (for more info read this)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 16 at 16:30

























        answered Jan 16 at 14:38









        ndemoundemou

        327211




        327211























            0














            [max@localhost ~]$ ll



            total 4



            drwxrwxr-x 2 max max 4096 Sep 25 17:11 zzz



            Here 2 means number of link count



            now I will create 3 directories inside zzz



            now value changes to 5




            [max@localhost ~]$ cd zzz
            [max@localhost zzz]$ mkdir a b c
            drwxrwxr-x 5 max max 4096 Sep 25 17:16 .
            drwx------ 5 max max 4096 Sep 25 17:12 ..
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 c


            [max@localhost zzz]$ cd



            [max@localhost ~]$ ll



            total 4



            drwxrwxr-x 5 max max 4096 Sep 25 17:16 zzz



            That is because now 5 directories are present inside zzz 3 are a b c and 2 are hidden directories . ..



            if I create file then nothing will happen to link count




            [max@localhost zzz]$ touch 1 2 3
            [max@localhost zzz]$ ls -al
            total 20
            drwxrwxr-x 5 max max 4096 Sep 25 17:26 . ------> current directory link count
            drwx------ 5 max max 4096 Sep 25 17:12 .. ------> parent directory link count
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 1
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 2
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 3
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 c
            [max@localhost zzz]$ cd
            [max@localhost ~]$ ll
            total 4
            drwxrwxr-x 5 max max 4096 Sep 25 17:26 zzz



            but if I delete any directory then link count will change




            [max@localhost zzz]$ rmdir b c
            [max@localhost zzz]$ cd
            [max@localhost ~]$ ll
            total 4
            drwxrwxr-x 3 max max 4096 Sep 25 17:28 zzz





            share|improve this answer
























            • Much (maybe too much) detail for dirs not a word for files.

              – ndemou
              Jan 16 at 16:26
















            0














            [max@localhost ~]$ ll



            total 4



            drwxrwxr-x 2 max max 4096 Sep 25 17:11 zzz



            Here 2 means number of link count



            now I will create 3 directories inside zzz



            now value changes to 5




            [max@localhost ~]$ cd zzz
            [max@localhost zzz]$ mkdir a b c
            drwxrwxr-x 5 max max 4096 Sep 25 17:16 .
            drwx------ 5 max max 4096 Sep 25 17:12 ..
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 c


            [max@localhost zzz]$ cd



            [max@localhost ~]$ ll



            total 4



            drwxrwxr-x 5 max max 4096 Sep 25 17:16 zzz



            That is because now 5 directories are present inside zzz 3 are a b c and 2 are hidden directories . ..



            if I create file then nothing will happen to link count




            [max@localhost zzz]$ touch 1 2 3
            [max@localhost zzz]$ ls -al
            total 20
            drwxrwxr-x 5 max max 4096 Sep 25 17:26 . ------> current directory link count
            drwx------ 5 max max 4096 Sep 25 17:12 .. ------> parent directory link count
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 1
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 2
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 3
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 c
            [max@localhost zzz]$ cd
            [max@localhost ~]$ ll
            total 4
            drwxrwxr-x 5 max max 4096 Sep 25 17:26 zzz



            but if I delete any directory then link count will change




            [max@localhost zzz]$ rmdir b c
            [max@localhost zzz]$ cd
            [max@localhost ~]$ ll
            total 4
            drwxrwxr-x 3 max max 4096 Sep 25 17:28 zzz





            share|improve this answer
























            • Much (maybe too much) detail for dirs not a word for files.

              – ndemou
              Jan 16 at 16:26














            0












            0








            0







            [max@localhost ~]$ ll



            total 4



            drwxrwxr-x 2 max max 4096 Sep 25 17:11 zzz



            Here 2 means number of link count



            now I will create 3 directories inside zzz



            now value changes to 5




            [max@localhost ~]$ cd zzz
            [max@localhost zzz]$ mkdir a b c
            drwxrwxr-x 5 max max 4096 Sep 25 17:16 .
            drwx------ 5 max max 4096 Sep 25 17:12 ..
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 c


            [max@localhost zzz]$ cd



            [max@localhost ~]$ ll



            total 4



            drwxrwxr-x 5 max max 4096 Sep 25 17:16 zzz



            That is because now 5 directories are present inside zzz 3 are a b c and 2 are hidden directories . ..



            if I create file then nothing will happen to link count




            [max@localhost zzz]$ touch 1 2 3
            [max@localhost zzz]$ ls -al
            total 20
            drwxrwxr-x 5 max max 4096 Sep 25 17:26 . ------> current directory link count
            drwx------ 5 max max 4096 Sep 25 17:12 .. ------> parent directory link count
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 1
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 2
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 3
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 c
            [max@localhost zzz]$ cd
            [max@localhost ~]$ ll
            total 4
            drwxrwxr-x 5 max max 4096 Sep 25 17:26 zzz



            but if I delete any directory then link count will change




            [max@localhost zzz]$ rmdir b c
            [max@localhost zzz]$ cd
            [max@localhost ~]$ ll
            total 4
            drwxrwxr-x 3 max max 4096 Sep 25 17:28 zzz





            share|improve this answer













            [max@localhost ~]$ ll



            total 4



            drwxrwxr-x 2 max max 4096 Sep 25 17:11 zzz



            Here 2 means number of link count



            now I will create 3 directories inside zzz



            now value changes to 5




            [max@localhost ~]$ cd zzz
            [max@localhost zzz]$ mkdir a b c
            drwxrwxr-x 5 max max 4096 Sep 25 17:16 .
            drwx------ 5 max max 4096 Sep 25 17:12 ..
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 c


            [max@localhost zzz]$ cd



            [max@localhost ~]$ ll



            total 4



            drwxrwxr-x 5 max max 4096 Sep 25 17:16 zzz



            That is because now 5 directories are present inside zzz 3 are a b c and 2 are hidden directories . ..



            if I create file then nothing will happen to link count




            [max@localhost zzz]$ touch 1 2 3
            [max@localhost zzz]$ ls -al
            total 20
            drwxrwxr-x 5 max max 4096 Sep 25 17:26 . ------> current directory link count
            drwx------ 5 max max 4096 Sep 25 17:12 .. ------> parent directory link count
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 1
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 2
            -rw-rw-r-- 1 max max 0 Sep 25 17:26 3
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 a
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 b
            drwxrwxr-x 2 max max 4096 Sep 25 17:16 c
            [max@localhost zzz]$ cd
            [max@localhost ~]$ ll
            total 4
            drwxrwxr-x 5 max max 4096 Sep 25 17:26 zzz



            but if I delete any directory then link count will change




            [max@localhost zzz]$ rmdir b c
            [max@localhost zzz]$ cd
            [max@localhost ~]$ ll
            total 4
            drwxrwxr-x 3 max max 4096 Sep 25 17:28 zzz






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 25 '12 at 12:10









            maxmax

            2,49794261




            2,49794261













            • Much (maybe too much) detail for dirs not a word for files.

              – ndemou
              Jan 16 at 16:26



















            • Much (maybe too much) detail for dirs not a word for files.

              – ndemou
              Jan 16 at 16:26

















            Much (maybe too much) detail for dirs not a word for files.

            – ndemou
            Jan 16 at 16:26





            Much (maybe too much) detail for dirs not a word for files.

            – ndemou
            Jan 16 at 16:26


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f477858%2fwhat-does-the-number-after-unix-linux-file-permissions-like-rw-rw-r-1-mea%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?