N1ng N1ng - 1 month ago 8
Linux Question

Linux mkdir to make directories with serial number

In my CentOS-7, I want to create some directories with names, say name001, name002, ... name003.

How to do this without typing

mkdir name001
mkdir name002

and so on?

Answer

remove the echo, if you are happy with the output

for i in $(seq -s " " -f %03g 1 10); do echo mkdir name${i}; done
Comments