Use ls -lg to find out to what group a file belongs.

On some versions of UNIX, typing ls -l shows you who owns the file, but not the name of the group that the file belongs to. To see the name of the group, run ls -lg on the file.

    % ls -lg ch01
    total 396
    -rw-r---- 1 lois sales 95232 Oct 20 11:48 ch01

You’ll see that after the name of the owner (lois) is the name of the group, in this case sales.

On System V-derived versions of UNIX, the group is automatically shown with ls -l. If your ls -l shows groups automatically, then you don’t need to supply the g option.

Get WYNTK: UNIX System Admininistrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.