1

In Linux use use AND Operators and it is represented by (&). In commands we can either use (&&) or (;). So, does a semi Colon (;) is also called an AND Operator?

2
5

No, a semicolon is not a boolean operator. It is however, just like &&, &, and newlines, a command terminator, marking the end of a command.

The difference between

cmd1; cmd2

and

cmd1 && cmd2

is that in the first case, cmd2 will always execute after cmd1 has terminated, while in the second case, cmd2 only executes if cmd1 terminated with a zero exit status (signalling "success").

With

cmd1 & cmd2

cmd1 is started as a background job (an asynchronous task), and cmd2 is started immediately after starting cmd1 (the two would run concurrently).

Both & and ; are called "list separators", separating lists of commands. In the POSIX shell grammar, they are called "separator operators".

4
  • Yes, I know its functionality. Actually I am looking for terminology for semi-colon. – Salman Ahmed May 12 '20 at 15:22
  • 1
    @SalmanAhmed This was not clear from the question, but I've added it to the answer. – Kusalananda May 12 '20 at 15:25
  • The bash manual describes them as control operators – glenn jackman May 12 '20 at 15:45
  • @glennjackman I'm sure it does. The main thing is that ; is not an "AND operator". – Kusalananda May 12 '20 at 16:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.