# Terminal Control Sequences

A Terminal Control Sequence is the ability to send inputs such as Ctrl+C or ESC via the Markdown. Given the special character nature of the control sequences, Katacoda has customized syntax to help if users wish to use this as part of the Markdown text.

# Stopping Processes with Ctrl+C

If you are running processes such as top or watch, before running the next command the current process needs to be stopped.

With Katacoda, including interrupt in the syntax on a command will send a Ctrl+C control sequence before running the command mentioned.

For example, the following command would stop the current process running and clear the terminal output

`clear`{{execute interrupt}}

# Control Sequences

Alongside the interrupt command above, certain Control Sequences can be sent.

Given a long running command, like top. It can be stopped using Ctrl+C.

The markdown for this is:

`^C`{{execute ctrl-seq}}

The use of control sequences can be useful when teaching applications such as vim.

The instructions can guide the user on how

  • Switch to insert mode by typing i

  • Once finished, press ESC (^ESC) to switch back to normal mode

  • To exit, type :q!

In the markdown, you would include:

* Switch to insert mode by typing `i`{{execute no-newline}}

* Once finished, press ESC ( `^ESC`{{execute ctrl-seq}} ) to switch back to normal mode

* To exit, type `:q!`{{execute}}

Notice the use of no-newline as a way to send a keystroke with a carriage return following it.

At the moment, only Ctrl+C and ESC are supported.

# Keyboard Icons

To help indicate that the control sequences being run are, Katacoda supports the Keyboard HTML syntax to render keyboard supports such as Ctrl+C.

In the Markdown this would be included as:

<kbd>Ctrl</kbd>+<kbd>C</kbd>

# Example and Demo

Learn more about these capabilities in the Katacoda Scenario on the Markdown Extensions available.