How do I display the group name of each file using the ls command in Linux?

Published on Aug. 22, 2023, 12:17 p.m.

To display the group name of each file using the ls command in Linux, you can use the -g option. The -l option is also commonly used with -g to display detailed information about each file, including its permissions, owner, group, size, and modification time. Here is an example command:

ls -l -g

This will list all the files in the current directory along with their group names. If you only want to display the group name and not the other details, you can use the -o option along with -g, like this:

ls -g -o

This will give you a more concise output that only shows the group name and file name.

Tags:

ls