Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

cash

> 编程语言
Open source

Cross-platform Linux commands in ES6

7.7K stars0 likes0 views
WebsiteGitHub

About

Cross-platform Linux commands in ES6

Cross-platform Linux commands in pure ES6 Cash is a cross-platform implementation of Unix shell commands written in straight ES6. No native compiling and no external dependencies.

While young, Cash aims to offer an alternative Linux feel on Windows and to open the door to cross-platform bash scripting in a Javascript environment.

bash
> npm install cash -g
> cash
$

Woah.

Yeah. But it gets better.

Let's mix some Windows & Unix commands together:

bash
$ ipconfig | grep IPv4 | sort
IPv4 Address. . . . . . . . . . . : 10.10.40.50
IPv4 Address. . . . . . . . . . . : 192.168.100.11
$

Learn more

But I don't want to type "cash"

No problem. Let's make all commands global on your system:

bash
> npm install cash-global -g
> ls -lah

Learn more

Nice, but I only want certain commands

You're covered!

bash
> npm install cash-ls -g
> npm install cash-grep -g

Learn more

Wow. But I want this programmatically!

Again, you're in business:

javascript
const $ = require('cash');
const out = $.ls('.', {l: true});

Not terse enough? How about this:

javascript
const out = $('ls -lah');

Not :sunglasses: enough? Try this:

javascript
require('cash') `
  cp -R ./src ./dest
  ls | grep *-spec.js | cat
  rm ./specResults.html 
`;

For even better programmatic Unix commands, check out ShellJS.

Learn more

Isn't this impossible to do in Node?

It was, before Vorpal.

Made with ❤ by dthree.

Love it? Give it a :star: or a tweet to help spread the word!

Notice

This is now an OPEN Open Source project. I am not able to invest a significant amount of time into maintaining Cash and so am looking for volunteers who would like to be active maintainers of the project. If you are interested, shoot me a note.

Contents

  • Introduction
  • Supported commands
  • Configuration (.cashrc)
  • Contributing
  • FAQ
  • Team
  • License
  • Wiki

Introduction

Cash is a project working on a cross-platform implementation of the most used Unix-based commands in pure JavaScript and with no external dependencies.

The goal of Cash is to open up these commands to the massive JavaScript community for the first time, and to provide a cleaner, simpler and flexible alternative to applications like Cygwin for those wanting the Linux feel on Windows.

Cash was built with strict attention to nearly exact implementations and excellent test coverage of over 200 unit tests.

Supported commands

The following commands are currently implemented:

  • alias
  • cat
  • clear
  • cd
  • cp
  • echo
  • export
  • false
  • grep
  • head
  • kill
  • less
  • ls
  • mkdir
  • mv
  • pwd
  • rm
  • sort
  • source
  • tail
  • touch
  • true
  • unalias

Want more commands?

  • Vote on the next commands
  • Help spread the word: More knowledge of Cash equals more contributors
  • Contribute

Configuration

Want to configure things to your heart's content? Just add your configurations in a .cashrc file (_cashrc also works, for Windows folk) and put that in your home directory. This supports anything you can do inside a cash command prompt (exporting environmental variables, aliases, etc.).

Contributing

  • Editing commands
  • Adding new commands

We are currently looking for Core Team members who can push forward Cash at a rapid rate. Are you an awesome developer up to the challenge? Send me a ping.

Awesome contributors

  • @nfischer: Added source, export, true and false commands, among several other contributions.
  • @safinn: Added clear and tail commands.
  • @legien: Added head command.
  • @cspotcode: Implemented template literal execution.

FAQ

Why Cash?

In its very essence, Cash replaces the Windows CLI prompt (>) with the Unix one ($), the dollar symbol.

Cash was most fitting in this sense:

Ask and ye shall receive

> cash
$

Cash is also a play on the word bash, and is actually[1] a recursive acronym for Cash Shell.

Shout out to @aseemk for donating the name.

Doesn't ShellJS do this?

No.

For those who don't know, ShellJS is an awesome Node package that implements UNIX shell commands programatically in JavaScript. Check it out - really. While ShellJS was tremendously helpful in figuring out how to accomplish Cash, the two do not really conflict.

ShellJS gives the feel of UNIX commands in a code environment, but aims to implement the commands in a way that makes sense for a JavaScript library. This means that many commands return JavaScript objects, and some of the rougher and more dangerous edges of bash have been softened a bit.

For example, with cash:

javascript
$('ls'); // 'node_modules\n'

$('echo foo > foo.txt');

With ShellJS:

javascript
ls(); // ['node_modules'];

echo('foo').to('foo.txt');

Team

David Caccavella Nate Fischer

Want to join the team? Let us know.

License

MIT © David Caccavella

Issues· 39 open

View all issuesOpen on GitHub
  • #74

    cash-global doesn't work in non-English operating systems

    Updated Jul 27, 2022
  • #126

    [Request] Change icon/logo to double-barred dollar sign

    Updated Apr 23, 2021
  • #120

    Help screen errors

    Updated Jan 13, 2020
  • #121

    touch Help screen not showing

    Updated Jan 8, 2020
  • #118

    So is this project still supported?

    Updated Jan 27, 2019
  • #119

    Support for commands with prompts repls, like vim, cmd, bash, node, etc.

    Updated Jan 22, 2019
  • #6

    standalone cash-cat doesn't copy stdin

    help wantednon-compliant behaviorUpdated Sep 29, 2018
  • #85

    cash-grep is 404

    Updated Sep 10, 2018
  • #94

    Not working some commands

    Updated Feb 2, 2018
  • #111

    cash rm -rf doesn't work

    Updated Oct 17, 2017

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言