Create multiple files in the terminal

January 13, 2021

You can create multiple files at once using the terminal. This is a little nice trick, and it's so handy once you get used to it.

Open a new terminal window and type:

touch {component,style,test,index}.js

Great. If you run ls -l to see what happened you'll see that 4 files have been created:

$ ls -l

total 0
-rw-r--r--  1 telmo  staff  0 Jan 13 15:43 component.js
-rw-r--r--  1 telmo  staff  0 Jan 13 15:43 index.js
-rw-r--r--  1 telmo  staff  0 Jan 13 15:43 style.js
-rw-r--r--  1 telmo  staff  0 Jan 13 15:43 test.js

Quick and easy!