How to create a directory and give permission in single command in Linux?
I have to create lots of folder with full permission 777
.
You could write a simple shell script, for example:
#!/bin/bash
mkdir "$1"
chmod 777 "$1"
Once saved, and the executable flag enabled, you could run it instead of mkdir and chmod:
./scriptname path/foldername
However, alex's answer is much better because it spawns one process instead of three. I didn't know about the -m
option.