2

Here is a command that I saw in a tutorial:

mkswap /swap && chown root. /swap && chmod 0600 /swap && swapon /swap

What does the . mean?

1
  • 1
    Wow you guys are awesome.. theres still so much stuff I dont know in linux bash commandlin'ing :) Thank you all Jun 15, 2017 at 0:44

2 Answers 2

10

The . in this context is a deprecated form of : and is a separator between the new owner and group.

From info chown:

   Some older scripts may still use ‘.’ in place of the ‘:’ separator.
POSIX 1003.1-2001 (*note 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 ‘.’.

So in this context it's the same as chown root: /swap, which in turn means

OWNER:
     If a colon but no group name follows OWNER, that user is made the
     owner of the files and the group of the files is changed to OWNER’s
     login group.

Since root's login group is root, it's equivalent to chown root:root /swap

1
  • 3
    Grrr! I was just writing my answer and you beat me to it. +1 =)
    – Terrance
    Jun 15, 2017 at 0:03
5

It is a shortened version of

sudo chown root:root /swap

as it will set the group to the same as the username.

Try creating a folder, then set the ownership to root that same way, then when completed, try setting the ownership to your username.

sudo chown $USER. folder/

Hope this help!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .