Skip to content

Terminal

Description and Purpose

Learning Environment (LE) layout components are interactive modules that typically replicate a real-world tool and allow learners to take specific actions in the exercise. Depending on which components are used in an exercise, different tests and checkpoint functionality may be available.

The Terminal component in the LE provides learners with an interface through which they can enter and run shell commands. It also has access to the root directory and can be used to create, destroy, modify and explore files and directories.

Content Location

This is a Layout Component that can be added to an exercise in a lesson or a project.

An exercise, represented as a rectangle, contains three other rectangles labeled narrative, checkpoints, and Terminal component. The terminal component shows a bash shell.

Component Selection in Author

To use a Terminal component in the LE, click “Select Layout” within an Exercise draft in Author and choose from one of the following options:

  • Terminal: This layout is useful for exercises that teach a shell, or Git, which can only be interacted with using the Terminal.
  • Code Editor, Terminal: This layout is useful for exercises that require the user to access the command line and write code.
  • Terminal, Image: This layout is useful for exercises that require the user to access the command line and also want to show a diagram or visual.
  • Terminal, Web Browser: This layout is useful for exercises that require the user to access the command line and view or go to a web page.
  • Code Editor, Read-only Code Editor, Terminal: This layout is useful for exercises that output compiled code into another code file in addition to requiring the learner to run commands. Code Editor, Terminal Image: This layout is useful for exercises that want to show a diagram or visual and require the user to write code and run commands.
  • Code Editor, Output Terminal, Terminal: This layout is useful for exercises that expect the learner to write code, run commands directly, and see standard output on behind-the-scenes build steps that happen when the “Run” button is clicked.
  • Code Editor, Terminal, Web Browser: This layout is useful for web development or data science exercises that require users to write or run code, run commands, and see a website or visualization.

Fields in Author

Shell Type

This is the type of shell the Terminal will run. Only one can be selected per workspace.

  • Bash: A shell type that allows learners to enter commands that can manipulate files and directories.
  • IRB: Stands for “Interactive Ruby” and provides a shell where Ruby code can be entered and executed.
  • Rails Console: Provides a direct interaction with a Rails application through Ruby code. To enter the Rails Console, type rails c in the terminal. To exit the console, type exit.

Terminal Fake Responses

A fake response can be used for commands that are not supported by the Learning Environment due to technical constraints. A list of commands that will be ignored, and instead output a predetermined response.

Note: If you add any fake terminal responses, all commands that previously worked in the Terminal will no longer work. You will now need to manually add all commands learners will need to use, even if they are not "fake", to this section as well.

Add Response+ Button

This button will create new fields that allow a new command and response to be added to the list of fake responses.

Delete Button

This button appears as a red trash can. Press this button to delete the fake command directly after it.

Command

Regex matching the command that the Terminal will recognize as a fake command.

Response

What the learner will see when the associated fake command is run.

Response Type

The type of response the learner will see. If you are not sure which to select, select Standard Output (stdout).

  • Standard Output (stdout)
  • Standard Error (stderr)

Response Delay

An artificial delay between the command and the output, for added realism. In ms.

Prevent Triggering Checkpoints After Commands

This setting can be enabled to avoid automatically running a checkpoint test when a learner inputs a command in the Terminal.

  • If using a Code Editor as well, enabling this setting and the Code Editor’s “Enable Autosave” settings will cause a “Check Work” button to replace the “Run” button. In this case, the “Check Work” button must be used by the learner to run any checkpoint tests.

Examples