Semicolon (;)
A semicolon (;) is used to denote the separation between commands that can be placed on the same line. The shell will scan the line until it encounters a semicolon.
All arguments that come before this semicolon will be treated as separate commands from those that come after the semicolon.
Both series will be carried out in order, with the shell waiting until each command has been completed before moving on to the next.
Example

As we can see in the above example, both of the commands are executed in sequential order. And we don’t have to write the commands on separate lines.
Ampersand (&)
The shell does not wait for a command to complete when a line ends with the ampersand &. The command runs in the background while you return to your shell prompt. When this command has completed running in the background, you will receive a notification.
Example

Dollar question mark ($?)
The shell variable $? contains the previous command's exit code. Since you cannot provide $? a value, it is a shell argument and not a variable.
Example

There are different exit codes for the different results of the command.
Double ampersand (&&)
&& will be interpreted by the shell as a logical AND. If you use &&, the second command is only carried out if the first one is successful (returns a zero exit status).
Example

Double vertical bar (||)
Logical OR is represented by the ||. Only when the first command fails is the second command carried out (returns a non-zero exit status).
Example

Combining (&&) and (||)
You can use this logical AND and logical OR to write an if-then-else structure on the command line.
Example

Pound sign (#)
The shell ignores everything that is written after the pound sign (#). This can be used to add a shell comment, but it has no bearing on how a command will run or how the shell will expand.
Example

Escaping special characters (\)
The backslash character makes it possible to use control characters, but doing so without the shell understanding them is known as escaping characters.
Example

End of line backslash
Lines that finish in a backslash are carried over to the next line. The shell does not interpret the newline character and will delay shell expansion and command line execution until it encounters a newline without a backslash.
Example

Frequently asked questions
What is the exit code in Linux?
An exit code in Linux represents the result of the execution of a command or script. It ranges from 0 to 255. We can tell whether a process ran successfully or not by looking at the exit codes.
What are two types of Linux User Mode?
Command Line and GUI are the two types of Linux user modes.
What is the maximum length for a filename under Linux?
Under Linux, a filename can only be 255 bytes long.
Conclusion
In this blog, we have discussed control operators in Linux with many examples, and we have also seen what all these control operators does.
If you think this blog has helped you enhance your knowledge about the above question, and if you want to learn more, check out our articles.
🔥 Linux - Decision Making
🔥 Linux File System
🔥 Linux- Shell Loops
🔥 Linux Security
And many more on our Coding Ninjas Studio.
Visit our website to read more such blogs. Make sure that you enroll in the courses we provide, take mock tests, solve problems available, and interview puzzles. Also, you can pay attention to interview stuff- interview experiences and an interview bundle for placement preparations.
Please upvote our blog to help other ninjas grow.
Happy Learning!