Find the group name of the folder in UNIX / Linux

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.

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 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

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.

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

Comments on this entry are closed.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.