Run Multiple Commands in Linux

In this tutorial, How to Run Multiple Commands in Linux at Once. You will executing multiple Linux commands at one.

On Linux, there are three ways to run multiple commands in terminal.

1. Using Logical OR (ll) operator


The syntax


command A || command B

if command A runs successfully, command B won't execute. Command B will only execute if command A fails

Example:

sudo find /tmp -name devopsroles.com || touch huuphan.com

The output terminal as below

2. Using the AND (&&) Operator


The syntax

command A && command B

Command A runs successfully, If command B not error.

Example:

mkdir /tmp/devopsroles && cd /tmp

The output terminal as below

3. Using the Semicolon(;) Operator


The syntax

command A ; command B
Command A and command B run executed sequentially 

The output terminal as below

Comments

Popular posts from this blog

zimbra some services are not running [Solve problem]

Bash script list all IP addresses connected to Server

How to install php7 on centos 6