How to Build Simple Terminal like Website using jQuery ?
Terminal is one of the most common tool used by developers. Many applications, frameworks, and even programming languages have more function which can be invoked using command line interface. Most of the computers come with at least one terminal in their operating system with command prompt now most replaced by cross-platform powershell in windows, and Linux console in Linux based OS’s.
Now open your favorite code editor and create our base html file mostly index.html and call our dependencies
Greetings in a default command which prints at the top of page for every time the page loads. It also plugin also contains an error command which prints out when the command is not present
We can also write additional command like founder command which prints the founder name of GeeksForGeeks and help command which prints. Both of these commands are passed without arguments
Now, we will change some styling using the style tag, we use green color for all text and increase the text size
The complete code is below
You have build a simple interactive terminal website and customized it. jquery.terminal can also do some other things like
- Formatting and Syntax Highlighting.
- JSON-RPC where everything is on the server (found in Interpreter section on the wiki).
- Changing prompt.
- Masking passwords.
- Combining commands with Pipe operator like in UNIX terminal.
- Keyboard shortcuts (list of build in you can find here).
- Reading text from users.
- Handling Emoji (if system don’t do that out of the box like Windows10).
- Invoking commands and terminal methods from Server.
- Updating lines.
- Saving state in URL hash and execute saved commands.