# jquery.terminal: a command line interface for your own commands

> A JavaScript library that gives a web page a working shell where every command is one you wrote, with JSON-RPC shortcuts, nested interpreters and bash style key bindings built in.

**jcubic/jquery.terminal** — jQuery Terminal Emulator - JavaScript library for creating web-based terminals with custom commands

- Repository: https://github.com/jcubic/jquery.terminal
- Website: https://terminal.jcubic.pl
- Stars: 3,238 · Forks: 574
- Language: JavaScript
- License: MIT
- Published: 2026-10-07 · Updated: 2026-10-07 · Language: en
- Canonical page: https://hysenlabs.com/projects/jcubic-jquery-terminal

## The fake terminal distinction the README makes first

The most useful thing in this README is a disclaimer, and it appears early. Because you code every command yourself, the author calls this a fake terminal emulator, and explicitly contrasts it with a library that gives you access to a real terminal such as online SSH, recommending xterm.js for that case.

That sentence tells you what problem you are solving before you install anything. jquery.terminal is an interface layer. It renders a prompt, captures keystrokes, manages history and tab completion, and then calls a JavaScript function you wrote. If what you want is a bash prompt that can run `ls` against a real filesystem, this is the wrong library and the README says so.

If what you want is a hosting control panel where `backup db` triggers a job, or a debugging console inside your app, this is exactly the right shape. The README also frames the appeal in terms of power users: an interface that offers more than clicking, for the subset of your users who will type a command if you give them the right ones.

## Two ways in: a URL for JSON-RPC or your own function

The summary describes two entry points. The first is a JSON-RPC service, which the README says you can wire up with one line by using a URL as the first argument. The second is a function you provide in which you parse commands yourself.

The JSON-RPC path is the more interesting one for the authentication story. The feature list says you can supply functions for when users enter a login and password, and that with JSON-RPC the library can call a login function on the server and pass the resulting token to all subsequent functions. In other words, auth is not something you bolt on afterwards; it is part of the same contract as the commands.

A third feature is the stack of interpreters, which lets a command trigger a different interpreter, so two JSON-RPC services can sit behind one prompt and switch when the user types. Combined with the command tree, where a nested object becomes a new interpreter with its own commands, this is a small command language rather than a flat list. A string value instead of an object creates a JSON-RPC service, which is a compact way to describe a whole backend in one literal.

## History, tab completion and the bash key bindings

History uses Local Storage when the browser allows it, and tab completion is supported. The keyboard layer is the part that makes a web terminal feel like a terminal rather than a text field: CTRL+A, CTRL+D, CTRL+E and the rest of the bash set, plus bash reverse history search on CTRL+R and CTRL+G. You can also create and overwrite existing shortcuts.

The reverse search is the feature that most often decides whether people keep using a web terminal, because it turns a wall of previous commands into something you can pull a line out of without reaching for the mouse. The README notes that shortcuts can be overwritten, which is how you would keep browser shortcuts working inside the terminal if they collide.

Multiple terminals on a single page are supported, and each one gets its own commands, its own authentication function and its own history. That matters more than it sounds: a page with an admin terminal and a debug terminal has to keep the two apart, and this is handled by the library rather than by your own state juggling.

## Errors, extended commands and how output actually renders

The README claims the library catches all exceptions and displays the error messages in the terminal, including errors from your JavaScript and PHP interpreter functions. That is a design decision with consequences. For a developer-facing console it is exactly right, because the stack trace lands where the person already is. For a customer-facing control panel, swallowing exceptions into on-screen text is something to think about, since it may surface internals you would rather not show.

The extended commands feature goes further in the same direction. You can change how the terminal behaves without touching front-end code, using the echo method along with terminal formatting such as syntax highlighting. The README links the API reference for it. This is the mechanism for a backend deciding that a particular line should be styled as an error or a warning, rather than your UI code hard-coding that decision.

The renderer understands ANSI escape codes, and there is a typing animation plus a canvas adapter. The package even ships a command line converter as a binary, mapping `from-ansi` to `bin/convert.js`, which is consistent with taking pasted ANSI output seriously rather than treating it as decoration.

## Loading it from a CDN and the build behind the release

Installation is a jQuery script tag followed by the library and its stylesheet. The README shows both a pinned version and unpinned variants, and the pinned form is the more useful one for production:

```html
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal@2.47.0/js/jquery.terminal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal@2.47.0/css/jquery.terminal.min.css"/>
```

Two things stand out. First, jQuery is still a dependency of this plugin, which the README handles by telling you to include it first, and the topics list still carries `jquery-plugin`. Second, a devel branch build is published on jsDelivr, and the README is candid that it is not refreshed as fast as the service it replaced, because a CDN has to propagate. That honesty tells you how to treat the devel build.

Behind the published files sits a Make-driven build. The Makefile assembles versioned filenames from templates with sed, minifies with uglifyjs, lints with eslint and typechecks with tsc, and the npm test script is literally `make test`, with jest configured in `jest.config.js` and specs in `__tests__/`. TypeScript definitions ship alongside, referenced from `package.json` as `js/jquery.terminal.d.ts`.

## What the recent releases tell you about the sharp edges

The three most recent tags are bug fixes plus one feature release, and the bug fixes are more informative than the features. Version 2.46.1 fixed mobile detection, and the feature list still describes mobile support as experimental with a link to the mobile open issue label. Version 2.46.2 fixed clipboard behaviour when the input uses a contenteditable style, fixed an exception when reading touch events, and fixed output disappearing from `get_output()` when a raw prompt was used.

That pattern, three of the four fixes touching input, clipboard or touch handling, is a reasonable signal about where a web terminal is fragile: it is an input surface emulating a device convention, and the browser is the wildcard.

Version 2.47.0 is the one to read if you depend on the echo command, because it contains a breaking change. Echo once more no longer shows up as a function in `export_view`, reverting the behaviour introduced in 2.46.0. The same release added heredoc support in command processing and allowed a promise as an interpreter, and it fixed formatters being applied to the echo command. If you are upgrading across that boundary, the export view is the thing to check rather than the command surface.

## Conclusion

The library is good at one thing: putting a real command line in front of an application that already has a function to call. Because every command is yours, the terminal becomes an interface rather than a decoration, and the JSON-RPC path can make that interface a thin shell over a backend in about a line. What it cannot do is give you a shell on a machine, which the README states plainly and points at xterm.js for. The practical starting point is a single terminal with a handful of commands and history enabled, then adding authentication once you know which of your commands need it. The tree, with its `examples/json-rpc` directory and paired PHP demo files, is the fastest way to see the intended shape before you design anything.

## FAQ

### Can jquery.terminal give me a real shell or SSH session in the browser?

No, and the README says so directly. The author calls it a fake terminal emulator because you define every command yourself, and points at xterm.js for real online SSH access. This library gives you the interface; the commands behind it have to be ones you implement or expose over JSON-RPC.

### Does jquery.terminal still require jQuery?

Yes. The installation instructions have you include a jQuery library from a CDN before the terminal script and stylesheet, and the repository topics still list it as a jQuery plugin. It is a plugin in the traditional sense, not a standalone widget, so the jQuery tag is not vestigial.

### How does authentication work with a JSON-RPC backend?

The feature list describes providing functions for when a user enters a login and password, and says that with JSON-RPC the library can call a login function on the server automatically and pass the returned token to all functions. Each terminal on a page carries its own authentication function, so separate terminals can authenticate separately.

### What changed in version 2.47.0 that could break existing code?

The release contains a breaking change: the echo command echoes a string again, reverting the 2.46.0 behaviour, so it no longer appears as a function in `export_view`. The same tag added heredoc support in command processing and support for a promise as an interpreter, so code relying on the old export view shape needs checking.

## Sources

- [jcubic/jquery.terminal on GitHub](https://github.com/jcubic/jquery.terminal)
- [License: MIT](https://github.com/jcubic/jquery.terminal/blob/master/LICENSE)
- [Project website](https://terminal.jcubic.pl)
- [README](https://github.com/jcubic/jquery.terminal/blob/master/README.md)
- [Releases](https://github.com/jcubic/jquery.terminal/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/jcubic-jquery-terminal
