# shelljs

> shell: Portable Unix shell commands for Node.js

- Type: agent or tool
- Field: System & Self-hosted
- Repository: https://github.com/shelljs/shelljs
- GitHub stars: 14398
- Licence: BSD-3-Clause
- Language: JavaScript
- Last push: 2026-10-25
- Page: https://imutechz.in/agents/shelljs

## What it is
ShellJS is a portable implementation of Unix shell commands built on top of the Node.js API, working on Windows, Linux and macOS. It lets developers write scripts that use familiar commands like cp, rm, sed and grep without depending on a Unix shell. Commands run synchronously by default and accept standard bash globbing characters. It can also be installed globally to run outside Node projects.

## Features
- Portable Unix-style commands for Windows, Linux and macOS
- Synchronous commands that accept bash globbing characters
- Supports options such as -n for cat and -R for chmod
- Third-party plugin API for custom commands
- Local or ES module import, with global import still supported
- Exclude options to pass parameters that look like flags

## Best for
- Cross-platform build and release scripts
- Replacing Bash scripts in Node.js projects
- File operations like copy, remove and search in scripts
- Running external tools synchronously from JavaScript

## Pros
- Removes a shell script's dependency on Unix while keeping familiar commands
- Tested on every LTS Node release since v18
- Commands accept standard bash globbing characters

## Cons
- Global import is no longer recommended because it pollutes the global namespace
- All commands run synchronously unless otherwise stated

## Install
```
npm install [-g] shelljs
```

## Usage
```
var shell = require('shelljs');
```

Tags: shelljs, nodejs, unix-commands, cross-platform, shell-scripting, file-operations, javascript, cli
