How to run multiple Unix commands in one time?

Short answer is, yes. The concept is known as shell scripting, or bash scripts (a common shell). In order to create a simple bash script, create a text file with this at the top:

#!/bin/bash

Then paste your commands inside of it, one to a line.

Save your file, usually with the .sh extension (but not required) and you can run it like:

sh foo.sh

Or you could change the permissions to make it executable:

chmod u+x foo.sh

Then run it like:

./foo.sh

Lots of resources available on this site and the web for more info, if needed.


echo 'hello' && echo 'world'

Just separate your commands with &&

Tags:

Unix

Shell