Using Bash instead Powershell, Bash vs Poweshell ?
Tags: bash, powershell
Published: 2022-09-23 04:34:45

> Time is money, Lets go to the point, no introduction.

Before we compare, we need to know when to use Bash or either PowerShell, Lets drive into it.

PowerShell and Bash are similar in some way. But different. We will talk about some major different in this article.

## Bash Uses, WHEN?
If you are running Linux systems, then you know about the need for automating tasks. Early tape drives were used for backups with tar archiving. These operations could be scripted in Bash and then run via a cron schedule. Anything to do with file manipulation such as archiving, copying, moving, renaming and deleting files are all right up Bash's alley.

### Advantage
- Quick start.
- Simple commands and syntax.
- Avoids repetitive work.
- Easy and interactive Code debugging.
- Easy program/file selection.
More and More

## PowerShell Uses, WHEN?
Windows PowerShell are really fast as you think. Most of the people use PowerShell.PowerShell can drill down into fine details to create powerful scripts that work, as well as some commercially available applications. PowerShell can pull data straight from the WMI subsystem, giving you real-time, deep-level information about anything from process IDs and Handle counts. 
PowerShell is plugged into the .NET framework, so you can create great looking menus and winforms that look like legitimate applications. You can use PowerShell to do anything from querying SQL Databases to grabbing your favorite RSS Feeds right into your PowerShell session for further manipulation. It is a real Swiss army knife for system administration within Windows environments.

### Advantage
-     Open Source.
-     Cross-platform.
-     Task automation.
-     Time-saving.
-     Rich command line-based interface.
-     Easier and flexible.
-     Secure scripting engine.
-     Easy debugging and testing.
More and More

# Some differents

## Bash is a CLI
Bash is a CLI, which stands for Command Language Interpreter. Like PowerShell, Bash is able to pass data between commands via pipes. This data is sent as strings though. This limits some of the things that you can do with the output from your scripts such as mathematical functions.

## PowerShell Handles Data Differently
PowerShell is different from Bash in the way it handles data. PowerShell is a scripting language, but it is able to feed data in different formats in a way that makes it feel like a programming language. PowerShell also deals with scopes in its scripts.

## PowerShell is Both CLI and Language
The default PowerShell Integrated Scripting Environment (ISE) that ships with Windows shows how you can quickly and easily create scripts without sacrificing direct access to a command line. By default, the top section lets you type out your lines of scripting code and quickly test it.

The window below is a PowerShell command line that gives you quick access to run single commands. This gives you the best of both worlds between a scripting language and a command-line shell. The ISE is a great tool to quickly prototype solutions.

## PowerShell and Bash are Both Powerful Tools
The environment that you work in will define which tool you choose. Linux systems administrators who script in Bash find it relatively easy to pick up PowerShell scripting. PowerShell scripting skills also translate over to Bash scripting to a certain degree.

The main differences between these two scripting languages are syntax and data handling. If you understand concepts such as variables and functions, then learning either one of these languages starts to make a lot of sense.

### Command line Compare

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r88knayj8wcs64n0coqs.png)

as you see, Bash command are easier than PowerShell and very handy to remember.

## Thought ? I want Bash? or PowerShell?

At the end of the day, comparing PowerShell to Bash is like comparing apples to oranges. Both are tools for different jobs. If you are managing a Windows environment or using Azure, try sticking with PowerShell. If you are managing a strictly Linux or Unix environment, try sticking with Bash.

visit for more [DevvSakib.me](http://devvsakib.me/blog)