Feb 22

create a directory tree

Catégorie : Tips and tricks, sysadmin, LinuxCharles Collier @ 9:14 pm

If you want to quick, don’t forget to use the ‘-p’ option

wrong way:
[john@host john]$ mkdir dev
[john@host john]$ cd dev
[john@host dev]$ mkdir first
[john@host dev]$ cd first
[john@host first]$ mkdir alpha
[john@host dev]$ mkdir second
[john@host dev]$ ll
[john@host dev]$ cd ..
[john@host john]$ mkdir prod
[john@host john]$ cd prod
[john@host prod]$ mkdir first
[john@host prod]$ mkdir second

good way:
[john@host john]$ mkdir -p dev/first/alpha

best way:
[john@host john]$ mkdir -p dev/{first/alpha,second},prod/{first,second}

Laisser une réponse