You can use mkdir -m instead of creating a directory with mkdir first and then changing the directory permissions with the chmod command. The argument to the -m (mode) option uses the same syntax as the chmod command.

# instead of this
$ mkdir back_up
$ chmod 750 back_up

# do this
$ mkdir -m 750 back_up
$ stat -c '%a %A' back_up
750 drwxr-x---

Here are some more examples:

$ mkdir -m =rx dummy_dir
$ stat -c '%a %A' dummy_dir
555 dr-xr-xr-x

$ mkdir -m go-rwx dot_files
$ stat -c '%a %A' dot_files
700 drwx------

Video demo:


info See also my Linux Command Line Computing ebook.