4

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?

5
  • 1
    gnu.org/software/coreutils/manual/html_node/… Commented Jan 19, 2017 at 3:06
  • @JeffSchaller Please make an answer. Commented Jan 19, 2017 at 3:17
  • I will in the morning if no one else has - but no need to wait if someone else would like to. Commented Jan 19, 2017 at 3:24
  • Also please note that chown user: filename will have the same effect. Commented Aug 23, 2018 at 15:44
  • In general, chown user. filename is not the shorthand for chown user:user filename. That's true only if user happens to be the login group of user. (gnu chown manual explains) Commented Jun 18, 2021 at 2:06

1 Answer 1

7

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.