A Cool Way to Create Multiple Files for your Project in WSL/WSL2
Published: 2021-04-01 08:40:36

For a long time now, Linux users seemed to have the upper hand when it comes to software development(with solid reasons to back them). But with the introduction of the now popular  [WSL (Windows Subsystem for Linux)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) , us windows folk have a reason to smile in regards to software development.

Today I'm not going to dive so much into the advantages of using Linux in software development, I want to share an interesting and cool way to create multiple files inside your Linux environment with the *touch* command.

**The Touch command**

The *touch* command is a standard command used in Linux based operating systems and it is used to create a file without any content [¹](https://www.geeksforgeeks.org/touch-command-in-linux-with-examples/****) .

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21qmz7zhkbnudxziste5.jpg)
The above code results in the creation of an empty index.ts file

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11nx7vo5u1tpw3yuourz.jpg)

**Creating Multiple files**

The same touch command can be used to create multiple files inside your project folder

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5obam0hq38w1qzoqqlst.jpg)

The above code will result in the creation of an empty db.js file, an empty users.tsx file and an empty auth.ts file inside your current folder.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l0bx960wx6g1k759awje.jpg)

---


### Leveling up inside the Linux terminal Matrix

If you have ever run into a task that requires the creation of multiple files of the same extension, it reaches a point where it gets too repetitive and that's what happened to me a while back when creating files in a previous project. The file extension was .graphql and creating 10 files with such a long extension was getting repetitive and boring. As a developer I knew that there was a better and easier way to do it.

Introducing the brace expansion command. This is a handy bash feature that allows you to create long lists of arbitrary string combinations. More info on this can be found on  [this Bash Hackers Wiki article](https://wiki.bash-hackers.org/syntax/expansion/brace) 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qo6fsotlvv16666452g.jpg)
The above code will result in the creation of 10 LOG files serially numbered and prefixed with the acc name

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ub566a6x3ksj5iwtzbml.jpg)
Now in my particular scenario, I wanted an easier way to create 10 files with the .graphql extension. My final resolve was to use the brace expansion command and type out all the file names in one instance then assign the files with the .graphql extension as shown below.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ivrmfuxl9rhmuig5nik.jpg)
The above code resulted in my expected result of 10 files with a .graphql extension

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rzchvz3n97sv03llx61i.jpg)
This worked to my satisfaction and was a deserved win from my google research session. All the tabs that were open during the research can now be closed

---

In conclusion, there are a lot of tasks that can be achieved with the brace expansion command that I have not touched on and that are efficient and effective in your day to day coding activities. 

The article on the  [Brace Expansion command](https://wiki.bash-hackers.org/syntax/expansion/brace)  dives deep into the many scenarios that might come in handy when using it in your tasks. I highly recommend that you have a look at it. 

Thank you for reaching the end and kindly leave a like or a heart if you found this article insightful. What are you planning to do with your new found Linux super power?