About | Buy | Forum | Industry Watch | Learning Curve | Products | Search | Twitter | Xnews
Home » Learning Curve » Hotspots

-o

Here we go again.


Buy It

Try It

Time to put the finishing touches on the FreeBSD/Darwin underbody to 10.5 Leopard. A last glance at the classic immutable command ls. Someone gets an idea.

Here's what the ls manpage for Tiger says.

-o      Include the file flags in a long (-l) output.

Those file flags are important. They include crucial things like 'system immutable' and 'system append'. Seeing them is very important.

Here's another excerpt from the same manpage.

-g      This option is only available for compatibility with POSIX; it is
        used to display the group name in the long (-l) format output.

There's also this.

-n      Display user and group IDs numerically rather than converting to
        a user or group name in a long (-l) output.

The file also says the following about the 'long format' output.

The Long Format
 If the -l option is given, the following information is displayed for
 each file: file mode, number of links, owner name, group name, number of
 bytes in the file, abbreviated month, day-of-month file was last modi-
 fied, hour file last modified, minute file last modified, and the path-
 name.

The following is a typical long format ls output.

$ ls -ailo
total 512
176268 drwxrwxr-x   20 root  admin  -   680 Dec  9 10:05 .
175713 drwxrwxr-x   15 root  admin  -   510 Dec  9 13:17 ..
176301 lrwxr-xr-x    1 root  admin  -    23 Dec  9 10:05 BuildStrings -> ../usr/bin/BuildStrings
176269 -rwxrwxr-x    1 root  admin  - 89088 Sep 24 04:28 CPlusTestRig
176302 lrwxr-xr-x    1 root  admin  -    16 Dec  9 10:05 CpMac -> ../usr/bin/CpMac
176303 lrwxr-xr-x    1 root  admin  -    16 Dec  9 10:05 DeRez -> ../usr/bin/DeRez
176304 lrwxr-xr-x    1 root  admin  -    22 Dec  9 10:05 GetFileInfo -> ../usr/bin/GetFileInfo
176305 lrwxr-xr-x    1 root  admin  -    19 Dec  9 10:05 MergePef -> ../usr/bin/MergePef
176306 lrwxr-xr-x    1 root  admin  -    16 Dec  9 10:05 MvMac -> ../usr/bin/MvMac
176307 lrwxr-xr-x    1 root  admin  -    21 Dec  9 10:05 PPCExplain -> ../usr/bin/PPCExplain
176308 lrwxr-xr-x    1 root  admin  -    20 Dec  9 10:05 ResMerger -> ../usr/bin/ResMerger
176309 lrwxr-xr-x    1 root  admin  -    14 Dec  9 10:05 Rez -> ../usr/bin/Rez
176310 lrwxr-xr-x    1 root  admin  -    17 Dec  9 10:05 RezDet -> ../usr/bin/RezDet
176311 lrwxr-xr-x    1 root  admin  -    18 Dec  9 10:05 RezWack -> ../usr/bin/RezWack
181164 -rwxrwxr-x    1 root  admin  -  3997 Sep 24 04:06 RunTargetUnitTests
178478 -rwxrwxr-x    1 root  admin  - 11590 Sep 24 04:03 RunUnitTests
176312 lrwxr-xr-x    1 root  admin  -    18 Dec  9 10:05 SetFile -> ../usr/bin/SetFile
176313 lrwxr-xr-x    1 root  admin  -    21 Dec  9 10:05 SplitForks -> ../usr/bin/SplitForks
176314 lrwxr-xr-x    1 root  admin  -    20 Dec  9 10:05 UnRezWack -> ../usr/bin/UnRezWack
181163 -rwxrwxr-x    1 root  admin  - 97008 Sep 24 04:06 otest

And if you were inspecting this directory (and you have every reason to inspect this precise directory) you'd be looking at a lot of things. Perhaps most importantly you'd be looking at the 'drwxrwxr-x' fields and comparing with the 'root:admin' columns. And why is that?

Because the three groups of 'rwx' correspond to the user and group ownerships of the files and that by correlating the two you can see who can do what with a file.

You need the 'root' column to see what the first 'rwx' group means. Read? Write? eXecute? For whom?

And the same applies to the second 'rwx' group: by comparing this group with the 'admin' column above you see who can do what with a file through their membership in a particular group.

This is about as endemic as bits are to bytes. Perhaps more so. And for the record: there are no further switches affecting the 'group' column with this command.

Now let's check how things have improved with 10.5 Leopard.

-o      List in long format, but omit the group id.

Somebody had a good idea. Why would anyone using a long format listing not want to see the group ownership?

You may have to put on a beige hat to understand that one. But here's more.

-O      Include the file flags in a long (-l) output.

You can almost see dweeb 2 sitting next to dweeb 1. And asking 'but why don't you just add '-O' to omit group ownership from long listings? If that's what you really want? Aren't you going to break hundreds of thousands of sysadmin scripts that have been in use for years?

But such is not what one worries about when one assembles the underbody to the world's most advanced operating system with the Rock Solid Foundation™.

STANDARDS
     The ls utility conforms to IEEE Std 1003.1-2001 (``POSIX.1'').

HISTORY
     An ls command appeared in Version 1 AT&T UNIX.

BUGS
     To maintain backward compatibility, the relationships between the many
     options are quite complex.

So who did it? Apple. But did they come up with the idea themselves? No. So who's idea is it?

The Open Group.

And as Apple want 'UNIX 03' certification they have to do things their way. And everybody else has to too.

And still remain compatible with Tiger or earlier. This despite the fact usage is now at odds with the FreeBSD whence things came once upon a time.

See Also
Technically Sound: Mixup

About | Buy | Forum | Industry Watch | Learning Curve | Products | Search | Twitter | Xnews
Copyright © Rixstep. All rights reserved.