Skip to Content

Linux Umask Calculator

Umask Calculator

How it works

The umask value defines the default permissions when a new file or directory is created.

For files: default permissions (666) - umask

For directories: default permissions (777) - umask

Example: If your umask is 022, then:

Get Your Free Linux training!

Join our free Linux training and discover the power of open-source technology. Enhance your skills and boost your career! Learn Linux for Free!

For files: 666 - 022 = 644 (which means the file will be created with rw-r–r–)

For directories: 777 - 022 = 755 (which means the directory will be created with rwxr-xr-x)

But this is not always correct.  Here are the mapping table between umask bit and permissions.

Umask Bit File Permissions (Default 666) Directory Permissions (Default 777)
0 rw- (read and write) rwx (read, write, and execute)
1 rw- (read and write, no execute) rw- (read and write)
2 r– (read only) r-x (read and execute)
3 r– (read only, no write or execute) r– (read only)
4 -w- (write only) -wx (write and execute)
5 -w- (write only, no read or execute) -w- (write only)
6 — (no permissions) –x (execute only)
7 — (no permissions) — (no permissions)

Umask Permission Calculator



File Permissions:
File Symbolic:
Directory Permissions:
Directory Symbolic:

File Permissions

 

Directory Permissions

 

Using the Umask Command in Linux

The umask command in Linux is used to set default permissions for newly created files and directories.

Here’s how to use it:

1. Check Current Umask Value

To see the current umask value, simply type:

umask

This will display the umask in octal format (e.g., 0022).

2. Set a New Umask Value

To set a new umask value, use the command:

umask [value]

For example, to set the umask to 0022:

umask 0022

This means:

  • Owner can read and write (rw-)
  • Group can read (r–)
  • Others can read (r–)

3. Using Umask in a Shell Session

If you want to make a temporary change for the duration of the current shell session, simply set it as shown above. Once you close the session, it will revert to the default value.

4. Making Umask Changes Permanent

To make umask changes permanent:

    1. Open your shell configuration file (e.g., ~/.bashrc, ~/.bash_profile, or ~/.profile) in a text editor.
    2. Add the line:
umask 0022
    1. Save the file and reload it using:
source ~/.bashrc

5. Understanding Umask Values

Umask values are typically specified in octal:

  • The default permissions for files are 666 (rw-rw-rw-) and for directories are 777 (rwxrwxrwx).
  • The umask value is subtracted from these defaults. For example, a umask of 0022 will result in:
    • Files: 666 – 022 = 644 (rw-r–r–)
    • Directories: 777 – 022 = 755 (rwxr-xr-x)

Example Usage

Setting umask to 007

umask 007

This means:

  • Owner can read, write, execute (rwx)
  • Group can read, write, execute (rwx)
  • Others have no permissions (—)

Creating a Directory

After setting umask 007, any new directory created will have rwxrwx— permissions by default.

umask file Permissions directory Permissions
000 rw-rw-rw- rwxrwxrwx
001 rw-rw-rw- rwxrwxrw-
002 rw-rw-r– rwxrwxr-x
003 rw-rw-r– rwxrwxr–
004 rw-rw–w- rwxrwx-wx
005 rw-rw–w- rwxrwx-w-
006 rw-rw—- rwxrwx–x
007 rw-rw—- rwxrwx—
010 rw-rw-rw- rwxrw-rwx
011 rw-rw-rw- rwxrw-rw-
012 rw-rw-r– rwxrw-r-x
013 rw-rw-r– rwxrw-r–
014 rw-rw–w- rwxrw–wx
015 rw-rw–w- rwxrw–w-
016 rw-rw—- rwxrw—x
017 rw-rw—- rwxrw—-
020 rw-r–rw- rwxr-xrwx
021 rw-r–rw- rwxr-xrw-
022 rw-r–r– rwxr-xr-x
023 rw-r–r– rwxr-xr–
024 rw-r—w- rwxr-x-wx
025 rw-r—w- rwxr-x-w-
026 rw-r—– rwxr-x–x
027 rw-r—– rwxr-x—
030 rw-r–rw- rwxr–rwx
031 rw-r–rw- rwxr–rw-
032 rw-r–r– rwxr–r-x
033 rw-r–r– rwxr–r–
034 rw-r—w- rwxr—wx
035 rw-r—w- rwxr—w-
036 rw-r—– rwxr—-x
037 rw-r—– rwxr—–
040 rw–w-rw- rwx-wxrwx
041 rw–w-rw- rwx-wxrw-
042 rw–w-r– rwx-wxr-x
043 rw–w-r– rwx-wxr–
044 rw–w–w- rwx-wx-wx
045 rw–w–w- rwx-wx-w-
046 rw–w—- rwx-wx–x
047 rw–w—- rwx-wx—
050 rw–w-rw- rwx-w-rwx
051 rw–w-rw- rwx-w-rw-
052 rw–w-r– rwx-w-r-x
053 rw–w-r– rwx-w-r–
054 rw–w–w- rwx-w–wx
055 rw–w–w- rwx-w–w-
056 rw–w—- rwx-w—x
057 rw–w—- rwx-w—-
060 rw—-rw- rwx–xrwx
061 rw—-rw- rwx–xrw-
062 rw—-r– rwx–xr-x
063 rw—-r– rwx–xr–
064 rw—–w- rwx–x-wx
065 rw—–w- rwx–x-w-
066 rw——- rwx–x–x
067 rw——- rwx–x—
070 rw—-rw- rwx—rwx
071 rw—-rw- rwx—rw-
072 rw—-r– rwx—r-x
073 rw—-r– rwx—r–
074 rw—–w- rwx—-wx
075 rw—–w- rwx—-w-
076 rw——- rwx—–x
077 rw——- rwx——
100 rw-rw-rw- rw-rwxrwx
101 rw-rw-rw- rw-rwxrw-
102 rw-rw-r– rw-rwxr-x
103 rw-rw-r– rw-rwxr–
104 rw-rw–w- rw-rwx-wx
105 rw-rw–w- rw-rwx-w-
106 rw-rw—- rw-rwx–x
107 rw-rw—- rw-rwx—
110 rw-rw-rw- rw-rw-rwx
111 rw-rw-rw- rw-rw-rw-
112 rw-rw-r– rw-rw-r-x
113 rw-rw-r– rw-rw-r–
114 rw-rw–w- rw-rw–wx
115 rw-rw–w- rw-rw–w-
116 rw-rw—- rw-rw—x
117 rw-rw—- rw-rw—-
120 rw-r–rw- rw-r-xrwx
121 rw-r–rw- rw-r-xrw-
122 rw-r–r– rw-r-xr-x
123 rw-r–r– rw-r-xr–
124 rw-r—w- rw-r-x-wx
125 rw-r—w- rw-r-x-w-
126 rw-r—– rw-r-x–x
127 rw-r—– rw-r-x—
130 rw-r–rw- rw-r–rwx
131 rw-r–rw- rw-r–rw-
132 rw-r–r– rw-r–r-x
133 rw-r–r– rw-r–r–
134 rw-r—w- rw-r—wx
135 rw-r—w- rw-r—w-
136 rw-r—– rw-r—-x
137 rw-r—– rw-r—–
140 rw–w-rw- rw–wxrwx
141 rw–w-rw- rw–wxrw-
142 rw–w-r– rw–wxr-x
143 rw–w-r– rw–wxr–
144 rw–w–w- rw–wx-wx
145 rw–w–w- rw–wx-w-
146 rw–w—- rw–wx–x
147 rw–w—- rw–wx—
150 rw–w-rw- rw–w-rwx
151 rw–w-rw- rw–w-rw-
152 rw–w-r– rw–w-r-x
153 rw–w-r– rw–w-r–
154 rw–w–w- rw–w–wx
155 rw–w–w- rw–w–w-
156 rw–w—- rw–w—x
157 rw–w—- rw–w—-
160 rw—-rw- rw—xrwx
161 rw—-rw- rw—xrw-
162 rw—-r– rw—xr-x
163 rw—-r– rw—xr–
164 rw—–w- rw—x-wx
165 rw—–w- rw—x-w-
166 rw——- rw—x–x
167 rw——- rw—x—
170 rw—-rw- rw—-rwx
171 rw—-rw- rw—-rw-
172 rw—-r– rw—-r-x
173 rw—-r– rw—-r–
174 rw—–w- rw—–wx
175 rw—–w- rw—–w-
176 rw——- rw——x
177 rw——- rw——-
200 r–rw-rw- r-xrwxrwx
201 r–rw-rw- r-xrwxrw-
202 r–rw-r– r-xrwxr-x
203 r–rw-r– r-xrwxr–
204 r–rw–w- r-xrwx-wx
205 r–rw–w- r-xrwx-w-
206 r–rw—- r-xrwx–x
207 r–rw—- r-xrwx—
210 r–rw-rw- r-xrw-rwx
211 r–rw-rw- r-xrw-rw-
212 r–rw-r– r-xrw-r-x
213 r–rw-r– r-xrw-r–
214 r–rw–w- r-xrw–wx
215 r–rw–w- r-xrw–w-
216 r–rw—- r-xrw—x
217 r–rw—- r-xrw—-
220 r–r–rw- r-xr-xrwx
221 r–r–rw- r-xr-xrw-
222 r–r–r– r-xr-xr-x
223 r–r–r– r-xr-xr–
224 r–r—w- r-xr-x-wx
225 r–r—w- r-xr-x-w-
226 r–r—– r-xr-x–x
227 r–r—– r-xr-x—
230 r–r–rw- r-xr–rwx
231 r–r–rw- r-xr–rw-
232 r–r–r– r-xr–r-x
233 r–r–r– r-xr–r–
234 r–r—w- r-xr—wx
235 r–r—w- r-xr—w-
236 r–r—– r-xr—-x
237 r–r—– r-xr—–
240 r—w-rw- r-x-wxrwx
241 r—w-rw- r-x-wxrw-
242 r—w-r– r-x-wxr-x
243 r—w-r– r-x-wxr–
244 r—w–w- r-x-wx-wx
245 r—w–w- r-x-wx-w-
246 r—w—- r-x-wx–x
247 r—w—- r-x-wx—
250 r—w-rw- r-x-w-rwx
251 r—w-rw- r-x-w-rw-
252 r—w-r– r-x-w-r-x
253 r—w-r– r-x-w-r–
254 r—w–w- r-x-w–wx
255 r—w–w- r-x-w–w-
256 r—w—- r-x-w—x
257 r—w—- r-x-w—-
260 r—–rw- r-x–xrwx
261 r—–rw- r-x–xrw-
262 r—–r– r-x–xr-x
263 r—–r– r-x–xr–
264 r——w- r-x–x-wx
265 r——w- r-x–x-w-
266 r——– r-x–x–x
267 r——– r-x–x—
270 r—–rw- r-x—rwx
271 r—–rw- r-x—rw-
272 r—–r– r-x—r-x
273 r—–r– r-x—r–
274 r——w- r-x—-wx
275 r——w- r-x—-w-
276 r——– r-x—–x
277 r——– r-x——
300 r–rw-rw- r–rwxrwx
301 r–rw-rw- r–rwxrw-
302 r–rw-r– r–rwxr-x
303 r–rw-r– r–rwxr–
304 r–rw–w- r–rwx-wx
305 r–rw–w- r–rwx-w-
306 r–rw—- r–rwx–x
307 r–rw—- r–rwx—
310 r–rw-rw- r–rw-rwx
311 r–rw-rw- r–rw-rw-
312 r–rw-r– r–rw-r-x
313 r–rw-r– r–rw-r–
314 r–rw–w- r–rw–wx
315 r–rw–w- r–rw–w-
316 r–rw—- r–rw—x
317 r–rw—- r–rw—-
320 r–r–rw- r–r-xrwx
321 r–r–rw- r–r-xrw-
322 r–r–r– r–r-xr-x
323 r–r–r– r–r-xr–
324 r–r—w- r–r-x-wx
325 r–r—w- r–r-x-w-
326 r–r—– r–r-x–x
327 r–r—– r–r-x—
330 r–r–rw- r–r–rwx
331 r–r–rw- r–r–rw-
332 r–r–r– r–r–r-x
333 r–r–r– r–r–r–
334 r–r—w- r–r—wx
335 r–r—w- r–r—w-
336 r–r—– r–r—-x
337 r–r—– r–r—–
340 r—w-rw- r—wxrwx
341 r—w-rw- r—wxrw-
342 r—w-r– r—wxr-x
343 r—w-r– r—wxr–
344 r—w–w- r—wx-wx
345 r—w–w- r—wx-w-
346 r—w—- r—wx–x
347 r—w—- r—wx—
350 r—w-rw- r—w-rwx
351 r—w-rw- r—w-rw-
352 r—w-r– r—w-r-x
353 r—w-r– r—w-r–
354 r—w–w- r—w–wx
355 r—w–w- r—w–w-
356 r—w—- r—w—x
357 r—w—- r—w—-
360 r—–rw- r—-xrwx
361 r—–rw- r—-xrw-
362 r—–r– r—-xr-x
363 r—–r– r—-xr–
364 r——w- r—-x-wx
365 r——w- r—-x-w-
366 r——– r—-x–x
367 r——– r—-x—
370 r—–rw- r—–rwx
371 r—–rw- r—–rw-
372 r—–r– r—–r-x
373 r—–r– r—–r–
374 r——w- r——wx
375 r——w- r——w-
376 r——– r——-x
377 r——– r——–
400 -w-rw-rw- -wxrwxrwx
401 -w-rw-rw- -wxrwxrw-
402 -w-rw-r– -wxrwxr-x
403 -w-rw-r– -wxrwxr–
404 -w-rw–w- -wxrwx-wx
405 -w-rw–w- -wxrwx-w-
406 -w-rw—- -wxrwx–x
407 -w-rw—- -wxrwx—
410 -w-rw-rw- -wxrw-rwx
411 -w-rw-rw- -wxrw-rw-
412 -w-rw-r– -wxrw-r-x
413 -w-rw-r– -wxrw-r–
414 -w-rw–w- -wxrw–wx
415 -w-rw–w- -wxrw–w-
416 -w-rw—- -wxrw—x
417 -w-rw—- -wxrw—-
420 -w-r–rw- -wxr-xrwx
421 -w-r–rw- -wxr-xrw-
422 -w-r–r– -wxr-xr-x
423 -w-r–r– -wxr-xr–
424 -w-r—w- -wxr-x-wx
425 -w-r—w- -wxr-x-w-
426 -w-r—– -wxr-x–x
427 -w-r—– -wxr-x—
430 -w-r–rw- -wxr–rwx
431 -w-r–rw- -wxr–rw-
432 -w-r–r– -wxr–r-x
433 -w-r–r– -wxr–r–
434 -w-r—w- -wxr—wx
435 -w-r—w- -wxr—w-
436 -w-r—– -wxr—-x
437 -w-r—– -wxr—–
440 -w–w-rw- -wx-wxrwx
441 -w–w-rw- -wx-wxrw-
442 -w–w-r– -wx-wxr-x
443 -w–w-r– -wx-wxr–
444 -w–w–w- -wx-wx-wx
445 -w–w–w- -wx-wx-w-
446 -w–w—- -wx-wx–x
447 -w–w—- -wx-wx—
450 -w–w-rw- -wx-w-rwx
451 -w–w-rw- -wx-w-rw-
452 -w–w-r– -wx-w-r-x
453 -w–w-r– -wx-w-r–
454 -w–w–w- -wx-w–wx
455 -w–w–w- -wx-w–w-
456 -w–w—- -wx-w—x
457 -w–w—- -wx-w—-
460 -w—-rw- -wx–xrwx
461 -w—-rw- -wx–xrw-
462 -w—-r– -wx–xr-x
463 -w—-r– -wx–xr–
464 -w—–w- -wx–x-wx
465 -w—–w- -wx–x-w-
466 -w——- -wx–x–x
467 -w——- -wx–x—
470 -w—-rw- -wx—rwx
471 -w—-rw- -wx—rw-
472 -w—-r– -wx—r-x
473 -w—-r– -wx—r–
474 -w—–w- -wx—-wx
475 -w—–w- -wx—-w-
476 -w——- -wx—–x
477 -w——- -wx——
500 -w-rw-rw- -w-rwxrwx
501 -w-rw-rw- -w-rwxrw-
502 -w-rw-r– -w-rwxr-x
503 -w-rw-r– -w-rwxr–
504 -w-rw–w- -w-rwx-wx
505 -w-rw–w- -w-rwx-w-
506 -w-rw—- -w-rwx–x
507 -w-rw—- -w-rwx—
510 -w-rw-rw- -w-rw-rwx
511 -w-rw-rw- -w-rw-rw-
512 -w-rw-r– -w-rw-r-x
513 -w-rw-r– -w-rw-r–
514 -w-rw–w- -w-rw–wx
515 -w-rw–w- -w-rw–w-
516 -w-rw—- -w-rw—x
517 -w-rw—- -w-rw—-
520 -w-r–rw- -w-r-xrwx
521 -w-r–rw- -w-r-xrw-
522 -w-r–r– -w-r-xr-x
523 -w-r–r– -w-r-xr–
524 -w-r—w- -w-r-x-wx
525 -w-r—w- -w-r-x-w-
526 -w-r—– -w-r-x–x
527 -w-r—– -w-r-x—
530 -w-r–rw- -w-r–rwx
531 -w-r–rw- -w-r–rw-
532 -w-r–r– -w-r–r-x
533 -w-r–r– -w-r–r–
534 -w-r—w- -w-r—wx
535 -w-r—w- -w-r—w-
536 -w-r—– -w-r—-x
537 -w-r—– -w-r—–
540 -w–w-rw- -w–wxrwx
541 -w–w-rw- -w–wxrw-
542 -w–w-r– -w–wxr-x
543 -w–w-r– -w–wxr–
544 -w–w–w- -w–wx-wx
545 -w–w–w- -w–wx-w-
546 -w–w—- -w–wx–x
547 -w–w—- -w–wx—
550 -w–w-rw- -w–w-rwx
551 -w–w-rw- -w–w-rw-
552 -w–w-r– -w–w-r-x
553 -w–w-r– -w–w-r–
554 -w–w–w- -w–w–wx
555 -w–w–w- -w–w–w-
556 -w–w—- -w–w—x
557 -w–w—- -w–w—-
560 -w—-rw- -w—xrwx
561 -w—-rw- -w—xrw-
562 -w—-r– -w—xr-x
563 -w—-r– -w—xr–
564 -w—–w- -w—x-wx
565 -w—–w- -w—x-w-
566 -w——- -w—x–x
567 -w——- -w—x—
570 -w—-rw- -w—-rwx
571 -w—-rw- -w—-rw-
572 -w—-r– -w—-r-x
573 -w—-r– -w—-r–
574 -w—–w- -w—–wx
575 -w—–w- -w—–w-
576 -w——- -w——x
577 -w——- -w——-
600 —rw-rw- –xrwxrwx
601 —rw-rw- –xrwxrw-
602 —rw-r– –xrwxr-x
603 —rw-r– –xrwxr–
604 —rw–w- –xrwx-wx
605 —rw–w- –xrwx-w-
606 —rw—- –xrwx–x
607 —rw—- –xrwx—
610 —rw-rw- –xrw-rwx
611 —rw-rw- –xrw-rw-
612 —rw-r– –xrw-r-x
613 —rw-r– –xrw-r–
614 —rw–w- –xrw–wx
615 —rw–w- –xrw–w-
616 —rw—- –xrw—x
617 —rw—- –xrw—-
620 —r–rw- –xr-xrwx
621 —r–rw- –xr-xrw-
622 —r–r– –xr-xr-x
623 —r–r– –xr-xr–
624 —r—w- –xr-x-wx
625 —r—w- –xr-x-w-
626 —r—– –xr-x–x
627 —r—– –xr-x—
630 —r–rw- –xr–rwx
631 —r–rw- –xr–rw-
632 —r–r– –xr–r-x
633 —r–r– –xr–r–
634 —r—w- –xr—wx
635 —r—w- –xr—w-
636 —r—– –xr—-x
637 —r—– –xr—–
640 —-w-rw- –x-wxrwx
641 —-w-rw- –x-wxrw-
642 —-w-r– –x-wxr-x
643 —-w-r– –x-wxr–
644 —-w–w- –x-wx-wx
645 —-w–w- –x-wx-w-
646 —-w—- –x-wx–x
647 —-w—- –x-wx—
650 —-w-rw- –x-w-rwx
651 —-w-rw- –x-w-rw-
652 —-w-r– –x-w-r-x
653 —-w-r– –x-w-r–
654 —-w–w- –x-w–wx
655 —-w–w- –x-w–w-
656 —-w—- –x-w—x
657 —-w—- –x-w—-
660 ——rw- –x–xrwx
661 ——rw- –x–xrw-
662 ——r– –x–xr-x
663 ——r– –x–xr–
664 ——-w- –x–x-wx
665 ——-w- –x–x-w-
666 ——— –x–x–x
667 ——— –x–x—
670 ——rw- –x—rwx
671 ——rw- –x—rw-
672 ——r– –x—r-x
673 ——r– –x—r–
674 ——-w- –x—-wx
675 ——-w- –x—-w-
676 ——— –x—–x
677 ——— –x——
700 —rw-rw- —rwxrwx
701 —rw-rw- —rwxrw-
702 —rw-r– —rwxr-x
703 —rw-r– —rwxr–
704 —rw–w- —rwx-wx
705 —rw–w- —rwx-w-
706 —rw—- —rwx–x
707 —rw—- —rwx—
710 —rw-rw- —rw-rwx
711 —rw-rw- —rw-rw-
712 —rw-r– —rw-r-x
713 —rw-r– —rw-r–
714 —rw–w- —rw–wx
715 —rw–w- —rw–w-
716 —rw—- —rw—x
717 —rw—- —rw—-
720 —r–rw- —r-xrwx
721 —r–rw- —r-xrw-
722 —r–r– —r-xr-x
723 —r–r– —r-xr–
724 —r—w- —r-x-wx
725 —r—w- —r-x-w-
726 —r—– —r-x–x
727 —r—– —r-x—
730 —r–rw- —r–rwx
731 —r–rw- —r–rw-
732 —r–r– —r–r-x
733 —r–r– —r–r–
734 —r—w- —r—wx
735 —r—w- —r—w-
736 —r—– —r—-x
737 —r—– —r—–
740 —-w-rw- —-wxrwx
741 —-w-rw- —-wxrw-
742 —-w-r– —-wxr-x
743 —-w-r– —-wxr–
744 —-w–w- —-wx-wx
745 —-w–w- —-wx-w-
746 —-w—- —-wx–x
747 —-w—- —-wx—
750 —-w-rw- —-w-rwx
751 —-w-rw- —-w-rw-
752 —-w-r– —-w-r-x
753 —-w-r– —-w-r–
754 —-w–w- —-w–wx
755 —-w–w- —-w–w-
756 —-w—- —-w—x
757 —-w—- —-w—-
760 ——rw- —–xrwx
761 ——rw- —–xrw-
762 ——r– —–xr-x
763 ——r– —–xr–
764 ——-w- —–x-wx
765 ——-w- —–x-w-
766 ——— —–x–x
767 ——— —–x—
770 ——rw- ——rwx
771 ——rw- ——rw-
772 ——r– ——r-x
773 ——r– ——r–
774 ——-w- ——-wx
775 ——-w- ——-w-
776 ——— ——–x
777 ——— ———

Summary

  • Use umask to control default permissions for new files and directories.
  • You can set it for the current session or make it permanent in configuration files.
  • Understanding the octal values helps in determining effective permissions.