Can I execute multiple actions (such as create two text files or directories simultaniously) in one line of code?

Step 13 on the second project of the navigating the file system lesson ( link: asks me to create 3 different text files in a directory.

Instead of adding these three files using three separate lines of code, i.e.

touch startups/disruptors/tech.txt
touch startups/disruptors/design.txt
touch startups/disruptors/education.txt

is it possible to add all three files using just one command line?
And more generally, is it possible to execute other actions simultaneously using just one command line?
If it is possible, when is it a good idea to do so, and when would it be better to use multiple lines of code?


(p.s. any tipps on improving my question or explanation for communicating in forums would be greatly appreciated, as this is my first time asking this type of question)

Welcome to the forums! :slight_smile:

At that point, you’re in the business directory, yes?

So, you can quite easily do:

touch startups/disruptors/tech.txt startups/disruptors/design.txt startups/disruptors/education.txt

There’s a bit more info on touch here.

Depends on what you mean.

In the touch example above, touch is able to accept a sequence of files and act on them accordingly. There’s no guarantee that this will necessarily be the case for any other utility program, so you shouldn’t assume you can do the same with something like like less.

If you mean can you use the output of a command with another subsequent command in one line, then this is also possible in bash thanks to the concept of a pipeline. There’s more on pipelines here; I would assume (but having not completed it, I can’t be sure) that the command line course might introduce these at some point?