Find the group name of the folder in UNIX / Linux

See all UNIX related articles/faq
How do I find out the owner and group of a directory in Linux? How can I find the group name of the folder in Unix?

Unix and Linux users are organized into groups. Each user is in at least one group and maybe in other secondary groups too. Group membership can give you exclusive access to files and directories belonging to that group. Group membership also allows you to access hardware devices and much more.
Advertisement

Find the group name of the folder in UNIX

The procedure to discover the group name of the folder in UNIX and Linux is as follows:

  1. Open the terminal application
  2. Run command on the folder: ls -ld /path/to/folder
  3. To find owner and group of a directory named /etc/ use: stat /etc/
  4. Use the Linux and Unix GUI file manager to locate the group name of the folder

Let us see some examples in details.

How to find owner and group of a directory in Linux

Say you want to find the group name of the $HOME/Downloads/ folder, run:
ls -ld $HOME/Downloads/
Second method is to run the stat command as follows:
stat /etc/
stat /home/vivek/Downloads/

Look for GID (group ID) and UID (User ID):
Find the group name of the folder in UNIX and Linux command

Find the group name of the folder in Linux or UNIX using GUI

nautilus is a file manager, designed for the GNOME 3 desktop.

  • Start the nautilus.
  • Choose the folder.
  • Right click it.
  • Select Properties and click on the Permissions tab
Check the ownership of directory in Linux GNOME GUI

How to check ownership of directory in Linux or Unix

Another option is to just run the following stat command:
stat -c "User:%U Group:%G" /path/to/dir/
stat -c "User:%U Group:%G" /etc/

Sample outputs:

User:root Group:root

One can pass the -c option for the specified FORMAT instead of the default. In this example:

  • %U – user name of owner
  • %G – group name of owner

Conclusion

One can use the stat command to display file status including owner and group names. The ls command provides information easily too. Finally, one can use the KDE or GNOME desktop file manager to obtain the group and owner names on Linux and Unix-like systems.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

Comments on this entry are closed.

Comments are closed. Still have questions? Post it on our forum