1.
Introduction
2.
Basic Operators in Linux
2.1.
Arithmetic operators
2.2.
Relational Operators
2.3.
Logical or Boolean Operators
2.4.
Bitwise Operators
2.5.
String Operators
3.
3.1.
What are the basic operators in Linux?
3.2.
What is the default shell in Linux?
3.3.
What operands do bitwise operators work with?
3.4.
What is the use of file test operators?
3.5.
What are string operators in Linux?
4.
Conclusion
Last Updated: Mar 27, 2024
Easy

# Linux - Basic Operators

Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

## Introduction

How many of you like mathematics?

Maybe maths isnâ€™t your favourite subject, but you may have a knack for it due to its extensive usefulness.

When we were kids, say around 7 or 8 years old, we were taught the basic operations of maths. Then, we only knew addition and subtraction, and soon after learned multiplication and division.

A few years later, we learned boolean algebra with operators like AND, OR, and NOT.

So, different kinds of mathematics have different basic operators.

Similarly, in Linux, different shells have different operators.

The default shell in Linux is the Bourne Shell or Bash. In this article, weâ€™ll learn about the basic operators in Linux in this default shell.

## Basic Operators in Linux

Just as in mathematics, we have basic operators like addition, subtraction, multiplication, and division, there are certain basic operators in Linux too. Those basic operators are

(i) Arithmetic operators to perform normal mathematical operations

(ii) Relational operators to define the relationship between two operands

(iii) Logical/Boolean operators to perform logical operations

(iv) Bitwise operators to perform Bitwise operations on bit patterns

(v) File test operators to test the properties of a file

(vi) String operators to test the properties of a string

Letâ€™s see what they are in detail in the subsequent sections.

### Arithmetic operators

Arithmetic operators perform the basic arithmetical operations like addition, subtraction, etc. The arithmetic operators in Linux are described in the table below.

### Relational Operators

Relational operators give the relation between two operands. In Linux, these operands may be a numeric value such as 17 or even a string that is numeric like â€ś17â€ť. The output given by this operator is either true (1) or false (0).

The relational operators in Linux are described below.

### Logical or Boolean Operators

The logical or boolean operators in Linux are the same as the operators we know in Boolean algebra.

Still, let us see what they are.

Note: The operands for the Boolean operators must be either 0 or 1.

### Bitwise Operators

As the name suggests, bitwise operators are used to operate on bit patterns. They are of six types, as shown below.

### String Operators

String operators are operators used for files. They are used to check the different properties of strings.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

### What are the basic operators in Linux?

The basic operators in Linux are divided into six categories: arithmetic, relational, logical/Boolean, file test, and string operators.

### What is the default shell in Linux?

The default shell in Linux is the Bourne Shell or Bash.

### What operands do bitwise operators work with?

Bitwise operators are used to operate on bit patterns.

### What is the use of file test operators?

File test operators are used to check the different properties of files.

### What are string operators in Linux?

String operators are operators used for files. They are used to check the different properties of strings.

## Conclusion

With this, we have finished learning about the basic operators in Linux. We learned about the six different types of operators and which operators fall under them. There we also some examples of each. Are we done yet, though?

Definitely not!

The basic operators in Linux are just a tiny part of it. Apart from it, there are lots more to learn about, but how will we do that?

Donâ€™t worry, as Coding Ninjas has got you covered with the basics of Linux curated in one place, Coding Ninjas Studio

Apart from that, donâ€™t forget to check out Data Structures and AlgorithmsCompetitive ProgrammingBasics of C++Data Structures and Algorithms in C++, and many more courses on Coding Ninjas.

Happy learning!

Live masterclass