Debian – Undocumented “chown user.” shorthand

chowndebian

I noticed by mistake one day this undocumented shorthand for chown:

chown user. filename

Which is the shorthand for:

chown user:user filename

The latter was a real pain to type when running it often, so the shorthand came in very handy. I tried looking for its documentation in the docs but never found a hint about that hidden feature.

Is this a POSIX compliant shorthand? Is it chown that parses it differently or a bash expansion of some sort? I'm using Debian 8.4 but I've been using that for many years already. Is it debian-implementation specific?

Best Answer

Thanks to @JeffSchaller for the answer.

Some older scripts may still use ‘.’ in place of the ‘:’ separator. POSIX 1003.1-2001 (see Standards conformance) does not require support for that, but for backward compatibility GNU chown supports ‘.’ so long as no ambiguity results. New scripts should avoid the use of ‘.’ because it is not portable, and because it has undesirable results if the entire owner‘.’group happens to identify a user whose name contains ‘.’.

This behavior is specific to GNU coreutils' chown command, and is not a function of bash. Being a GNU utility, it is also not Debian-specific.