If you use Windows, how do you run Linux commands on Windows?
Let me guess, Cygwin or perhaps Git Bash. These are the two most popular choices when it comes to running Linux commands on Windows. But I am not going to bore you with the usual suspects today.
Cash: Run Linux commands on Windows in style
With Cash installed, you can run a ‘set of Unix commands’ in any terminal emulator on Windows including the Windows Command Prompt.
Did I say a ‘set of Unix commands’? Yes, because like other emulators, Cash too has support for a limited set of Unix commands. The list of supported commands at the time of writing this article is:
Since this tool are under heavy development, more commands are being added into the list. As a user, you even have a say in what commands are supported in the future.
If you are wondering how Cash works, have a look at the image below:
Even better is that you can actually mix Windows and Unix commands. For example, you can run:
ipconfig | grep IPv4 | sort
And the command above will actually work here with ipconfig Windows command and grep being the Linux command. Isn’t it cool?
Install Cash in Windows
I used Windows 10 while installing Cash but I am pretty certain that the same steps will work for older versions of Windows as well.
Once you have Node.js installed, you can now proceed with installing Cash. There are various modes in which Cash can be installed:
- Using Cash programmatically: You run command ‘cash’ to go in interactive mode to run Unix commands
- Using Cash globally: No need to run command ‘cash’. Unix commands are at your disposal for execution
- Installing selective commands: You can in fact choose what commands you want to install with Cash, if you don’t want to install all the predefined commands
I suggest to go for installing Cash globally. Open Windows Command Prompt (Windows+R and then type cmd) and run the following command:
npm install cash-global -g
It takes just a few minutes, even less, depending upon your internet speed. This will install Cash globally with all the supported commands. I let you play with the commands.
As I mentioned before, Cash is a project under development and hence there are chances that you will encounter bugs. If you do, to help the open source community grow, please open an issue on the Cash’s GitHub project.
Since I am a Linux user, I don’t really use such tools to run Linux commands on Windows because I work on Linux directly. But in case, you cannot install Linux for any reason but still want to use Linux commands, do give Cash a try.