4

I type the umask command in linux shell and it returns 002 as output. I know what for umask command used. But what 002 represents. please help me

1
  • 0x2 is write. Hence, files will not be writable by others by default.
    – knittl
    Commented Oct 14, 2013 at 6:00

2 Answers 2

13

It shows the default permission levels by which a file will be created.
Subtracting umask from base permission would give you actual file permissions.
All the files will be created with 664 (666-002) permissions and dir with 775 (777-002) permissions.

2
  • imean which bit represents what?
    – Sri Harsha
    Commented Oct 14, 2013 at 6:03
  • 2
    The order is rwx (read-write-execute), and the bitmask is defined as r=4, w=2, x=1, so 002 equals w only. Commented Oct 14, 2013 at 7:35
1

It means that files created will not be world-writable by default.

Not the answer you're looking for? Browse other questions tagged or ask your own question.