Extensible jQuery Based Command Line Emulator - Ptty

File Size: 14.4 KB
Views Total: 10224
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Extensible jQuery Based Command Line Emulator - Ptty

Ptty is another jQuery based terminal emulator to create customizable and nice-looking command line interpreters on your webpage/application. You can easily add your own commands via $.register_command() method. Fully stylable via CSS.

Basic usage:

1. Include the jQuery Ptty plugin's script and stylesheet in the document. Make sure the Ptty.jquery.js file is loaded after the jQuery JavaScript library.

<link rel="stylesheet" href="css/Ptty.css">

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="js/Ptty.jquery.js"></script>

2. Create a container element where you wish to embed the terminal emulator.

<div id="terminal"></div>

3. Call the plugin on the container element and register your commands.

// initialize

// register a command
  // command name

  // command description

  // command usage

  // command dispatch

4. Available options to customize the terminal emulator.


  // The HTTP Method that will be used for Ajax Requests
  ajax_options : {
      url  : window.location.pathname,
      type : 'POST'

  // The GET/POST parameter that should be used to make requests
  param        : 'cmd',

  // The Primary Prompt (it's better to edit this using css)
  ps           : '$',

  // Caret (the cursor)
  caret        : '\u25ae', // Black Vertical Rectangle ▮
  caret_blink  : 800,

  // use native css and default theme name.
  native_css   : true,
  theme        : 'boring',

  // Register help, clear and history commands
  native_cmds  : true,

  // Is Autocomplete feature Enabled
  autocomplete : true,

  // Number of entries to be stored in history (0 = off)
  history_max  : 800,

  // Autofocus on input on load
  autofocus    : true,

  // Run this function before every command
  before_cmd   : false,

  // Run this function after every command
  after_cmd    : false,

  // Language
  i18n : {
      // Message to be shown when the terminal is first
      welcome : 'Ptty ('+version+').<br> Type <b>help</b> to list the available commands.',
      // When command is not found: "CMD" will be replaced
      error_not_found : 'Command not found.',
      // If command method is not valid
      error_bad_method : 'Invalid command method.',
      // Ajax response failed
      error_ajax : 'Server error.'




  • Temp-fixed the loading element.


  • autofocus on multiple instances


  • Scroll bug reappeared, and was fixed again. CSS fixes, method adition.


  • v0.0.5


  • v0.0.4


  • Fixed a bug


  • Fixed a bug previenting subroutine ps to work.


  • Fixed css overflow in PS


  • minor css change

This awesome jQuery plugin is developed by pachanka. For more Advanced Usages, please check the demo page or visit the official website.