Multiple commands in Linux

For those that do not know how to string multiple commands together, here is a quick reference for you:

[user@server foobar]$ command1 ; command2

The command is executed in the order it was written, but command 2 is executed even if there was an error in command 1.

[user@server foobar]$ command1 && command2

The command command2 is executed only if command1 was successful, no errors.

 

You may also like