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:
- Open the terminal application
- Run command on the folder: ls -ld /path/to/folder
- To find owner and group of a directory named /etc/ use: stat /etc/
- 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:
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/
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
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.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
|Category||List of Unix and Linux commands|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|