Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
278
rated 0 times [  278] [ 0]  / answers: 1 / hits: 910309  / 2 Years ago, mon, september 12, 2022, 3:40:50

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


More From » permissions

 Answers
3

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

[#36210] Monday, September 12, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ouschee

Total Points: 485
Total Questions: 88
Total Answers: 106

Location: Central African Republic
Member since Mon, Aug 10, 2020
4 Years ago
;