How to find owner and group of a directory?












103















How can I find out owner and group of a directory in Ubuntu?










share|improve this question





























    103















    How can I find out owner and group of a directory in Ubuntu?










    share|improve this question



























      103












      103








      103


      21






      How can I find out owner and group of a directory in Ubuntu?










      share|improve this question
















      How can I find out owner and group of a directory in Ubuntu?







      permissions files






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 29 '14 at 11:54









      Flyk

      1,38931624




      1,38931624










      asked Aug 12 '12 at 20:52









      Gaurav AgarwalGaurav Agarwal

      3,368164162




      3,368164162






















          5 Answers
          5






          active

          oldest

          votes


















          130














          You can do this:
          1st way:



          ls -l /path/to/file


          *the third field in the ls -l output is the user and the fourth is the group



          2nd way:



          stat /path/to/file



          $ stat py
          File: `py'
          Size: 32 Blocks: 8 IO Block: 4096 regular file
          Device: 801h/2049d Inode: 429064 Links: 1
          Access: (0777/-rwxrwxrwx) Uid: ( 1000/ razvan) Gid: ( 1000/ razvan)
          Access: 2012-07-27 17:49:05.682143441 +0300
          Modify: 2012-07-01 03:58:02.848540175 +0300
          Change: 2012-08-01 21:12:57.129819212 +0300


          The razvan in the Uid field is the owner/user, the razvan in the Gid field is the group. 8-|



          3rd way:
          Get only the user and group with stat:



          stat -c "%U %G" /path/to/file





          share|improve this answer





















          • 3





            The default bashrc in ubuntu aliases ll to ls -l

            – Nemo
            Aug 13 '12 at 3:41











          • As a heads up this is for GNU stat, specific to ubuntu this works, but looking for a portable (BSD supported solution) this is not the answer for you.

            – Luke Exton
            Oct 14 '16 at 16:29













          • FWIW, on BSD (mac) this would be stat -f "%u %g" /path/to/file

            – KarlKFI
            Apr 6 '17 at 1:37











          • 3rd way is for me <3 Thank you!

            – Nam G VU
            1 hour ago



















          17














          Run ls with the -l flag to show the owner and group-owner of files and directories in the current directory (or in a specific named directory).



          ~$ ls -l
          drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
          ...


          ~$ ls -l /home/username
          drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
          ...


          Run ls with the -l and -d flags to show this information about the current directory itself (or about a specific named directory):



          ~$ ls -ld
          drwxr-xr-x 2 owner group 4096 Aug 12 19:12 .


          ~$ ls -ld ~/Desktop
          drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop





          share|improve this answer

































            11














            To get the owner and group of a directory you need



            ls -ld /path/to/folder


            Otherwise you get the attributes of the contents of the directory.






            share|improve this answer































              3














              In Nautilus (the GUI file manager)




              • Find the folder corresponding to the directory


              • Right click it.


              • Select Properties


              • Select the Permissions Tab



              Providing you have the permission to change the permissions you can change them from that window, too.






              share|improve this answer































                0














                My subtle way



                ls -alF /path/to/folder | grep -Ei ' ./'


                sample output



                drwxr-xr-x 2 some-user some-group 4096 Feb 28 02:29 ./





                share|improve this answer
























                • Of course shorter way still to be stat /path/to/folder command

                  – Nam G VU
                  1 hour ago










                protected by Community Jan 11 '17 at 16:40



                Thank you for your interest in this question.
                Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                Would you like to answer one of these unanswered questions instead?














                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                130














                You can do this:
                1st way:



                ls -l /path/to/file


                *the third field in the ls -l output is the user and the fourth is the group



                2nd way:



                stat /path/to/file



                $ stat py
                File: `py'
                Size: 32 Blocks: 8 IO Block: 4096 regular file
                Device: 801h/2049d Inode: 429064 Links: 1
                Access: (0777/-rwxrwxrwx) Uid: ( 1000/ razvan) Gid: ( 1000/ razvan)
                Access: 2012-07-27 17:49:05.682143441 +0300
                Modify: 2012-07-01 03:58:02.848540175 +0300
                Change: 2012-08-01 21:12:57.129819212 +0300


                The razvan in the Uid field is the owner/user, the razvan in the Gid field is the group. 8-|



                3rd way:
                Get only the user and group with stat:



                stat -c "%U %G" /path/to/file





                share|improve this answer





















                • 3





                  The default bashrc in ubuntu aliases ll to ls -l

                  – Nemo
                  Aug 13 '12 at 3:41











                • As a heads up this is for GNU stat, specific to ubuntu this works, but looking for a portable (BSD supported solution) this is not the answer for you.

                  – Luke Exton
                  Oct 14 '16 at 16:29













                • FWIW, on BSD (mac) this would be stat -f "%u %g" /path/to/file

                  – KarlKFI
                  Apr 6 '17 at 1:37











                • 3rd way is for me <3 Thank you!

                  – Nam G VU
                  1 hour ago
















                130














                You can do this:
                1st way:



                ls -l /path/to/file


                *the third field in the ls -l output is the user and the fourth is the group



                2nd way:



                stat /path/to/file



                $ stat py
                File: `py'
                Size: 32 Blocks: 8 IO Block: 4096 regular file
                Device: 801h/2049d Inode: 429064 Links: 1
                Access: (0777/-rwxrwxrwx) Uid: ( 1000/ razvan) Gid: ( 1000/ razvan)
                Access: 2012-07-27 17:49:05.682143441 +0300
                Modify: 2012-07-01 03:58:02.848540175 +0300
                Change: 2012-08-01 21:12:57.129819212 +0300


                The razvan in the Uid field is the owner/user, the razvan in the Gid field is the group. 8-|



                3rd way:
                Get only the user and group with stat:



                stat -c "%U %G" /path/to/file





                share|improve this answer





















                • 3





                  The default bashrc in ubuntu aliases ll to ls -l

                  – Nemo
                  Aug 13 '12 at 3:41











                • As a heads up this is for GNU stat, specific to ubuntu this works, but looking for a portable (BSD supported solution) this is not the answer for you.

                  – Luke Exton
                  Oct 14 '16 at 16:29













                • FWIW, on BSD (mac) this would be stat -f "%u %g" /path/to/file

                  – KarlKFI
                  Apr 6 '17 at 1:37











                • 3rd way is for me <3 Thank you!

                  – Nam G VU
                  1 hour ago














                130












                130








                130







                You can do this:
                1st way:



                ls -l /path/to/file


                *the third field in the ls -l output is the user and the fourth is the group



                2nd way:



                stat /path/to/file



                $ stat py
                File: `py'
                Size: 32 Blocks: 8 IO Block: 4096 regular file
                Device: 801h/2049d Inode: 429064 Links: 1
                Access: (0777/-rwxrwxrwx) Uid: ( 1000/ razvan) Gid: ( 1000/ razvan)
                Access: 2012-07-27 17:49:05.682143441 +0300
                Modify: 2012-07-01 03:58:02.848540175 +0300
                Change: 2012-08-01 21:12:57.129819212 +0300


                The razvan in the Uid field is the owner/user, the razvan in the Gid field is the group. 8-|



                3rd way:
                Get only the user and group with stat:



                stat -c "%U %G" /path/to/file





                share|improve this answer















                You can do this:
                1st way:



                ls -l /path/to/file


                *the third field in the ls -l output is the user and the fourth is the group



                2nd way:



                stat /path/to/file



                $ stat py
                File: `py'
                Size: 32 Blocks: 8 IO Block: 4096 regular file
                Device: 801h/2049d Inode: 429064 Links: 1
                Access: (0777/-rwxrwxrwx) Uid: ( 1000/ razvan) Gid: ( 1000/ razvan)
                Access: 2012-07-27 17:49:05.682143441 +0300
                Modify: 2012-07-01 03:58:02.848540175 +0300
                Change: 2012-08-01 21:12:57.129819212 +0300


                The razvan in the Uid field is the owner/user, the razvan in the Gid field is the group. 8-|



                3rd way:
                Get only the user and group with stat:



                stat -c "%U %G" /path/to/file






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Aug 12 '12 at 21:13

























                answered Aug 12 '12 at 21:04









                fromnaboofromnaboo

                1,7541107




                1,7541107








                • 3





                  The default bashrc in ubuntu aliases ll to ls -l

                  – Nemo
                  Aug 13 '12 at 3:41











                • As a heads up this is for GNU stat, specific to ubuntu this works, but looking for a portable (BSD supported solution) this is not the answer for you.

                  – Luke Exton
                  Oct 14 '16 at 16:29













                • FWIW, on BSD (mac) this would be stat -f "%u %g" /path/to/file

                  – KarlKFI
                  Apr 6 '17 at 1:37











                • 3rd way is for me <3 Thank you!

                  – Nam G VU
                  1 hour ago














                • 3





                  The default bashrc in ubuntu aliases ll to ls -l

                  – Nemo
                  Aug 13 '12 at 3:41











                • As a heads up this is for GNU stat, specific to ubuntu this works, but looking for a portable (BSD supported solution) this is not the answer for you.

                  – Luke Exton
                  Oct 14 '16 at 16:29













                • FWIW, on BSD (mac) this would be stat -f "%u %g" /path/to/file

                  – KarlKFI
                  Apr 6 '17 at 1:37











                • 3rd way is for me <3 Thank you!

                  – Nam G VU
                  1 hour ago








                3




                3





                The default bashrc in ubuntu aliases ll to ls -l

                – Nemo
                Aug 13 '12 at 3:41





                The default bashrc in ubuntu aliases ll to ls -l

                – Nemo
                Aug 13 '12 at 3:41













                As a heads up this is for GNU stat, specific to ubuntu this works, but looking for a portable (BSD supported solution) this is not the answer for you.

                – Luke Exton
                Oct 14 '16 at 16:29







                As a heads up this is for GNU stat, specific to ubuntu this works, but looking for a portable (BSD supported solution) this is not the answer for you.

                – Luke Exton
                Oct 14 '16 at 16:29















                FWIW, on BSD (mac) this would be stat -f "%u %g" /path/to/file

                – KarlKFI
                Apr 6 '17 at 1:37





                FWIW, on BSD (mac) this would be stat -f "%u %g" /path/to/file

                – KarlKFI
                Apr 6 '17 at 1:37













                3rd way is for me <3 Thank you!

                – Nam G VU
                1 hour ago





                3rd way is for me <3 Thank you!

                – Nam G VU
                1 hour ago













                17














                Run ls with the -l flag to show the owner and group-owner of files and directories in the current directory (or in a specific named directory).



                ~$ ls -l
                drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
                ...


                ~$ ls -l /home/username
                drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
                ...


                Run ls with the -l and -d flags to show this information about the current directory itself (or about a specific named directory):



                ~$ ls -ld
                drwxr-xr-x 2 owner group 4096 Aug 12 19:12 .


                ~$ ls -ld ~/Desktop
                drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop





                share|improve this answer






























                  17














                  Run ls with the -l flag to show the owner and group-owner of files and directories in the current directory (or in a specific named directory).



                  ~$ ls -l
                  drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
                  ...


                  ~$ ls -l /home/username
                  drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
                  ...


                  Run ls with the -l and -d flags to show this information about the current directory itself (or about a specific named directory):



                  ~$ ls -ld
                  drwxr-xr-x 2 owner group 4096 Aug 12 19:12 .


                  ~$ ls -ld ~/Desktop
                  drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop





                  share|improve this answer




























                    17












                    17








                    17







                    Run ls with the -l flag to show the owner and group-owner of files and directories in the current directory (or in a specific named directory).



                    ~$ ls -l
                    drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
                    ...


                    ~$ ls -l /home/username
                    drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
                    ...


                    Run ls with the -l and -d flags to show this information about the current directory itself (or about a specific named directory):



                    ~$ ls -ld
                    drwxr-xr-x 2 owner group 4096 Aug 12 19:12 .


                    ~$ ls -ld ~/Desktop
                    drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop





                    share|improve this answer















                    Run ls with the -l flag to show the owner and group-owner of files and directories in the current directory (or in a specific named directory).



                    ~$ ls -l
                    drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
                    ...


                    ~$ ls -l /home/username
                    drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
                    ...


                    Run ls with the -l and -d flags to show this information about the current directory itself (or about a specific named directory):



                    ~$ ls -ld
                    drwxr-xr-x 2 owner group 4096 Aug 12 19:12 .


                    ~$ ls -ld ~/Desktop
                    drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 12 '12 at 22:13









                    Eliah Kagan

                    82.4k22227368




                    82.4k22227368










                    answered Aug 12 '12 at 21:04









                    OrangeTuxOrangeTux

                    3,59582452




                    3,59582452























                        11














                        To get the owner and group of a directory you need



                        ls -ld /path/to/folder


                        Otherwise you get the attributes of the contents of the directory.






                        share|improve this answer




























                          11














                          To get the owner and group of a directory you need



                          ls -ld /path/to/folder


                          Otherwise you get the attributes of the contents of the directory.






                          share|improve this answer


























                            11












                            11








                            11







                            To get the owner and group of a directory you need



                            ls -ld /path/to/folder


                            Otherwise you get the attributes of the contents of the directory.






                            share|improve this answer













                            To get the owner and group of a directory you need



                            ls -ld /path/to/folder


                            Otherwise you get the attributes of the contents of the directory.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 12 '12 at 21:13









                            StarNamerStarNamer

                            2,4571424




                            2,4571424























                                3














                                In Nautilus (the GUI file manager)




                                • Find the folder corresponding to the directory


                                • Right click it.


                                • Select Properties


                                • Select the Permissions Tab



                                Providing you have the permission to change the permissions you can change them from that window, too.






                                share|improve this answer




























                                  3














                                  In Nautilus (the GUI file manager)




                                  • Find the folder corresponding to the directory


                                  • Right click it.


                                  • Select Properties


                                  • Select the Permissions Tab



                                  Providing you have the permission to change the permissions you can change them from that window, too.






                                  share|improve this answer


























                                    3












                                    3








                                    3







                                    In Nautilus (the GUI file manager)




                                    • Find the folder corresponding to the directory


                                    • Right click it.


                                    • Select Properties


                                    • Select the Permissions Tab



                                    Providing you have the permission to change the permissions you can change them from that window, too.






                                    share|improve this answer













                                    In Nautilus (the GUI file manager)




                                    • Find the folder corresponding to the directory


                                    • Right click it.


                                    • Select Properties


                                    • Select the Permissions Tab



                                    Providing you have the permission to change the permissions you can change them from that window, too.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Aug 12 '12 at 22:11









                                    John S GruberJohn S Gruber

                                    11.5k32959




                                    11.5k32959























                                        0














                                        My subtle way



                                        ls -alF /path/to/folder | grep -Ei ' ./'


                                        sample output



                                        drwxr-xr-x 2 some-user some-group 4096 Feb 28 02:29 ./





                                        share|improve this answer
























                                        • Of course shorter way still to be stat /path/to/folder command

                                          – Nam G VU
                                          1 hour ago
















                                        0














                                        My subtle way



                                        ls -alF /path/to/folder | grep -Ei ' ./'


                                        sample output



                                        drwxr-xr-x 2 some-user some-group 4096 Feb 28 02:29 ./





                                        share|improve this answer
























                                        • Of course shorter way still to be stat /path/to/folder command

                                          – Nam G VU
                                          1 hour ago














                                        0












                                        0








                                        0







                                        My subtle way



                                        ls -alF /path/to/folder | grep -Ei ' ./'


                                        sample output



                                        drwxr-xr-x 2 some-user some-group 4096 Feb 28 02:29 ./





                                        share|improve this answer













                                        My subtle way



                                        ls -alF /path/to/folder | grep -Ei ' ./'


                                        sample output



                                        drwxr-xr-x 2 some-user some-group 4096 Feb 28 02:29 ./






                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered 1 hour ago









                                        Nam G VUNam G VU

                                        7341925




                                        7341925













                                        • Of course shorter way still to be stat /path/to/folder command

                                          – Nam G VU
                                          1 hour ago



















                                        • Of course shorter way still to be stat /path/to/folder command

                                          – Nam G VU
                                          1 hour ago

















                                        Of course shorter way still to be stat /path/to/folder command

                                        – Nam G VU
                                        1 hour ago





                                        Of course shorter way still to be stat /path/to/folder command

                                        – Nam G VU
                                        1 hour ago





                                        protected by Community Jan 11 '17 at 16:40



                                        Thank you for your interest in this question.
                                        Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                        Would you like to answer one of these unanswered questions instead?



                                        Popular posts from this blog

                                        GameSpot

                                        日野市

                                        Tu-95轟炸機