Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "AmigaOS Manual: AmigaDOS Understanding the Shell"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
  +
 
An AmigaDOS Shell is a special window on the Workbench screen that accepts text input, allowing you to communicate with AmigaDOS. The Shell is a type of Command Line Interface or CLI. This chapter describes the following:
 
An AmigaDOS Shell is a special window on the Workbench screen that accepts text input, allowing you to communicate with AmigaDOS. The Shell is a type of Command Line Interface or CLI. This chapter describes the following:
 
* About the Shell
 
* Opening and closing Shell windows
 
* Using the Shell
 
   
 
= About the Shell =
 
= About the Shell =
   
You can communicate directly with AmigaDOS through a Shell console window, a text-only interface that accepts input entered from the keyboard. The Shell window looks and acts like a Workbench window with these exceptions:
+
You can communicate directly with AmigaDOS through a Shell console window, a text-only interface that accepts input entered from the keyboard. The Shell window looks and acts like a Workbench window with some exceptions:
 
* Icons cannot be dragged into the Shell window.
 
* The mouse can only be used for copy and paste operations, except within the ED and MEmacs text editors.
 
* Scroll gadgets do not appear.
 
* The AmigaDOS Shell window uses only a non-proportional font, normally the System Default Text font (Topaz or Courier) specified by the Font Preferences editor.
 
* Any Workbench background patterns set in WBPattern do not appear in Shell windows.
 
   
  +
* Icons dragged into the Shell window do not initiate a file move or copy operation; rather any icon dragged into the Shell window will cause the Shell to auto-type the icon's name and full path into the command prompt
Figure 2-1 illustrates a Shell window opened on the Workbench screen.
 
  +
* The mouse has somewhat limited use; it can be used for copy and paste operations, except within the ED and MEmacs text editors, or for selecting autocompleted commands from a pop-up menu if enabled in the Shell preferences
  +
* Scroll gadgets work as you would expect, except that the length of Shell history captured may be limited by user preference
  +
* The AmigaDOS Shell window uses a non-proportional font by default, normally the System Default Text font, e.g. DejaVu Sans Mono, specified by the Font Preferences editor.
  +
* Any Workbench background patterns set in WBPattern do not appear in Shell windows
   
  +
Like Workbench, several independent Shell windows can be open at the same time. While commands entered in one Shell are being executed, you can enter and execute different commands in another Shell window. You can also combine Shell windows into a single window, with each Shell session accessible via tabs. Figure 2-1 illustrates a Shell window opened on the Workbench screen:
[[File:DosFig2-1.png|center|frame|Shell Window]]
 
   
  +
[[File:DosFig2-1.png|none|frame|Shell Window with Tabs]]
Like Workbench, several independent Shell windows can be open at the same time. While commands entered in one Shell are being executed, you can enter and execute different commands in another Shell window.
 
   
 
= Opening Shell Windows =
 
= Opening Shell Windows =
   
Shell windows can be opened in one of two ways:
+
Shell windows can be opened in one of several ways:
   
* Click on the Shell icon in the Workbench System drawer.
+
* Click on the Shell icon in the Workbench System drawer
  +
* Click on the Shell icon in your AmiDock (if enabled)
* Use the NEWSHELL command described in Chapter 6.
 
  +
* Use the NEWSHELL command described in Chapter 6
  +
* Select 'New shell' from any already open Shell session
  +
* Select 'Shell Here' from the 'New' submenu in any Workbench contextual pop-up menu
   
 
When a Shell window is opened:
 
When a Shell window is opened:
Line 32: Line 30:
 
* The window is highlighted, indicating that it is the current window
 
* The window is highlighted, indicating that it is the current window
 
* A prompt appears, such as 1.SYS: >
 
* A prompt appears, such as 1.SYS: >
* To the right of the prompt is a cursor, a small highlighted rectangle
+
* To the right of the prompt is a cursor, the default being a small highlighted rectangle
   
Like Workbench, only the currently selected window can receive input. To enter information in a different window, click in it to make it the current window. While a Shell window is the current window, no menus are available in the Workbench title bar.
+
Like Workbench, only the currently selected Shell can receive input. To enter information in a different Shell, click in its window (or select its tab) to make it the current Shell session.
   
 
= Closing Shell windows =
 
= Closing Shell windows =
   
Use one of the following three ways to close a Shell window:
+
Use one of the following four ways to close a Shell window:
   
 
* Select the close gadget
 
* Select the close gadget
  +
* Select 'Close' from the Project menu
* Enter the ENDSHELL command
 
  +
* Enter the ENDCLI command
* Press Ctrl+\
 
  +
* Press <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">\</kbd>
   
 
We recommend closing Shell windows when you are finished with them. Any open window uses memory.
 
We recommend closing Shell windows when you are finished with them. Any open window uses memory.
Line 52: Line 51:
 
Enter AmigaDOS commands at the Shell's text prompt. Include with the command any necessary information, such as file names or command options. Press Return at the end of each command line to execute the command. The Shell prompt reappears when the command is finished executing.
 
Enter AmigaDOS commands at the Shell's text prompt. Include with the command any necessary information, such as file names or command options. Press Return at the end of each command line to execute the command. The Shell prompt reappears when the command is finished executing.
   
To see command output that has scrolled out of the Shell window, enlarge the window by selecting the Shell zoom gadget or using the sizing gadget. This reveals as much of the previous contents of the window as fits. Figure 2-2 illustrates a Shell window before and after using the zoom gadget to display the entire output of a LIST command.
+
To see command output that has scrolled out of the Shell window, use the scroller gadgets to scroll up or down; you can also enlarge the window by selecting the Shell zoom gadget or using the sizing gadget. The Shell window will keep a full scrollback history of as many lines as you specify using the Console prefs tool. Figure 2-2 illustrates a Shell window before and after using the zoom gadget to display the entire output of an INFO command.
   
  +
[[File:DosFig2-2a.png|none|frame|Current Output]]
Figure 2-2. Revealing Previous Output with the Zoom Gadget
 
  +
  +
[[File:DosFig2-2b.png|none|frame|Revealing Previous Output with the Scroller Gadget]]
   
 
== Command Line Editing and Control ==
 
== Command Line Editing and Control ==
Line 71: Line 72:
 
| Backspace || Deletes the character to the left of the cursor.
 
| Backspace || Deletes the character to the left of the cursor.
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Del</kbd> || Deletes the character highlighted by the cursor.
| Del || Deletes the character highlighted by the cursor.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">H</kbd> || Deletes the last character (same as Backspace).
| Ctrl+H || Deletes the last character (same as Backspace).
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">M</kbd> || Processes the command line (same as Return).
| Ctrl+M || Processes the command line (same as Return).
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">J</kbd> || Adds a line feed.
| Ctrl+J || Adds a line feed.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">W</kbd> || Deletes the word to the left of the cursor.
| Ctrl+W || Deletes the word to the left of the cursor.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">X</kbd> || Deletes the current line.
| Ctrl+X || Deletes the current line.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">K</kbd> || Deletes everything from the cursor forward to the end of the line.
| Ctrl+K || Deletes everything from the cursor forward to the end of the line.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Y</kbd> || Replaces the characters deleted with <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">K</kbd>.
| Ctrl+Y || Replaces the characters deleted with Ctrl+K.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">U</kbd> || Deletes everything from the cursor backward to the start of the line.
| Ctrl+U || Deletes everything from the cursor backward to the start of the line.
 
 
|}
 
|}
   
Line 97: Line 98:
 
| Backspace || Resumes output (continues scrolling).
 
| Backspace || Resumes output (continues scrolling).
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">C</kbd> || Sends a BREAK command to the current process (halts the process).
| Ctrl+C || Sends a BREAK command to the current process (halts the process).
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">D</kbd> || Sends at BREAK command to the current script (halts the script).
| Ctrl+D || Sends at BREAK command to the current script (halts the script).
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">F</kbd> || Activates and brings Workbench program windows to the front.
| Ctrl+F || Activates and brings Workbench program windows to the front.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">S</kbd> || Suspends output.
| Ctrl+S || Suspends output.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Q</kbd> || Resumes output if it was suspended with Ctrl+S.
| Ctrl+Q || Resumes output if it was suspended with Ctrl+S.
 
 
|-
 
|-
  +
| <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">Ctrl</kbd> + <kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; border-radius: 0.2em; box-shadow: 0.1em 0.2em 0.2em #ddd; background-color: #f9f9f9; background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee); background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee); padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">\</kbd> || Closes the Shell window. When console |/O is redirected to another device with * restores normal |/O.
| Ctrl+\ || Closes the Shell window. When console |/O is redirected to another device with * restores normal |/O.
 
 
|}
 
|}
   
Line 118: Line 119:
 
The Shell uses a 2 KB command line buffer to retain command lines, which provides a command history. Using this history you can recall previously entered command lines, edit them, and re-execute them. This lets you easily repeat a command or enter several similar commands. Figure 2-3 illustrates a series of commands stored in the command history buffer.
 
The Shell uses a 2 KB command line buffer to retain command lines, which provides a command history. Using this history you can recall previously entered command lines, edit them, and re-execute them. This lets you easily repeat a command or enter several similar commands. Figure 2-3 illustrates a series of commands stored in the command history buffer.
   
Figure 2-3. Command History Buffer
+
[[File:DosFig2-3.png|none|frame|Command History Buffer]]
   
 
The exact number of lines retained in the command line buffer varies depending on the length of the lines actually stored. When the buffer is full, the oldest lines are removed. You can access lines in the buffer with the up and down arrow keys:
 
The exact number of lines retained in the command line buffer varies depending on the length of the lines actually stored. When the buffer is full, the oldest lines are removed. You can access lines in the buffer with the up and down arrow keys:
Line 134: Line 135:
 
== Copying and Pasting ==
 
== Copying and Pasting ==
   
You can copy and paste information from one console window, such as a Shell or ED window, to the same or another window. This is the only Workbench-style mouse operation performed in Shell windows, except for within the ED and MEmacs text editors. Figure 2-4 illustrates copying and pasting from the Shell window to the ED window.
+
You can copy and paste information from one console window, such as a Shell or ED window, to the same or another window. This done by selecting commands in the Edit menu, just like in most Amiga tools. Figure 2-4 illustrates copying and pasting from the Shell window to a Notepad window.
  +
  +
[[File:DosFig2-4a.png|none|frame|Copy]]
   
  +
[[File:DosFig2-4b.png|none|frame|Paste]]
Figure 2-4. Copy and Paste
 
   
Use the mouse to highlight the area of text to be copied and pasted. Highlight the text to be copied by moving the pointer to the beginning of the text area, holding down the selection button, and dragging the mouse pointer to the end of the desired text. Release the selection button and press Right Amiga+C. The highlighted area is copied into the Clipboard and the area is unhighlighted. The text you copied can be repeatedly pasted into any application window that supports reading text from the Clipboard, such as the Shell, ED, and MEmacs.
+
Use the mouse to highlight the area of text to be copied and pasted. Highlight the text to be copied by moving the pointer to the beginning of the text area, holding down the selection button, and dragging the mouse pointer to the end of the desired text. Release the selection button and press Right Amiga+C or select Copy from the Edit menu. The highlighted area is copied into the Clipboard and the area is unhighlighted. The text you copied can be repeatedly pasted into any application window that supports reading text from the Clipboard, such as the Shell, Notepad, and MultiEdit.
   
 
To position the cursor where you want to paste the text, move the mouse pointer to that location and click. Press right Amiga+V to paste the text.
 
To position the cursor where you want to paste the text, move the mouse pointer to that location and click. Press right Amiga+V to paste the text.

Latest revision as of 16:12, 31 January 2021

An AmigaDOS Shell is a special window on the Workbench screen that accepts text input, allowing you to communicate with AmigaDOS. The Shell is a type of Command Line Interface or CLI. This chapter describes the following:

About the Shell

You can communicate directly with AmigaDOS through a Shell console window, a text-only interface that accepts input entered from the keyboard. The Shell window looks and acts like a Workbench window with some exceptions:

  • Icons dragged into the Shell window do not initiate a file move or copy operation; rather any icon dragged into the Shell window will cause the Shell to auto-type the icon's name and full path into the command prompt
  • The mouse has somewhat limited use; it can be used for copy and paste operations, except within the ED and MEmacs text editors, or for selecting autocompleted commands from a pop-up menu if enabled in the Shell preferences
  • Scroll gadgets work as you would expect, except that the length of Shell history captured may be limited by user preference
  • The AmigaDOS Shell window uses a non-proportional font by default, normally the System Default Text font, e.g. DejaVu Sans Mono, specified by the Font Preferences editor.
  • Any Workbench background patterns set in WBPattern do not appear in Shell windows

Like Workbench, several independent Shell windows can be open at the same time. While commands entered in one Shell are being executed, you can enter and execute different commands in another Shell window. You can also combine Shell windows into a single window, with each Shell session accessible via tabs. Figure 2-1 illustrates a Shell window opened on the Workbench screen:

Shell Window with Tabs

Opening Shell Windows

Shell windows can be opened in one of several ways:

  • Click on the Shell icon in the Workbench System drawer
  • Click on the Shell icon in your AmiDock (if enabled)
  • Use the NEWSHELL command described in Chapter 6
  • Select 'New shell' from any already open Shell session
  • Select 'Shell Here' from the 'New' submenu in any Workbench contextual pop-up menu

When a Shell window is opened:

  • The window is highlighted, indicating that it is the current window
  • A prompt appears, such as 1.SYS: >
  • To the right of the prompt is a cursor, the default being a small highlighted rectangle

Like Workbench, only the currently selected Shell can receive input. To enter information in a different Shell, click in its window (or select its tab) to make it the current Shell session.

Closing Shell windows

Use one of the following four ways to close a Shell window:

  • Select the close gadget
  • Select 'Close' from the Project menu
  • Enter the ENDCLI command
  • Press Ctrl + \

We recommend closing Shell windows when you are finished with them. Any open window uses memory.

All non-detached programs that run from a Shell must be finished before you can close the window. You can tell that a program is still active if pressing Return does not produce a Shell prompt in the window. Although you can still enter commands into such a window, AmigaDOS does not respond to the commands until the running program is exited.

Using the Shell

Enter AmigaDOS commands at the Shell's text prompt. Include with the command any necessary information, such as file names or command options. Press Return at the end of each command line to execute the command. The Shell prompt reappears when the command is finished executing.

To see command output that has scrolled out of the Shell window, use the scroller gadgets to scroll up or down; you can also enlarge the window by selecting the Shell zoom gadget or using the sizing gadget. The Shell window will keep a full scrollback history of as many lines as you specify using the Console prefs tool. Figure 2-2 illustrates a Shell window before and after using the zoom gadget to display the entire output of an INFO command.

Current Output
Revealing Previous Output with the Scroller Gadget

Command Line Editing and Control

To simplify entering and editing command line text, the AmigaDOS Shell provides the following editing key and key combination options:

left arrow Moves cursor one character to the left.
right arrow Moves cursor one character to the right.
Shift+left arrow Moves cursor to the beginning of the line.
Shift+right arrow Moves cursor to the end of the line.
Backspace Deletes the character to the left of the cursor.
Del Deletes the character highlighted by the cursor.
Ctrl + H Deletes the last character (same as Backspace).
Ctrl + M Processes the command line (same as Return).
Ctrl + J Adds a line feed.
Ctrl + W Deletes the word to the left of the cursor.
Ctrl + X Deletes the current line.
Ctrl + K Deletes everything from the cursor forward to the end of the line.
Ctrl + Y Replaces the characters deleted with Ctrl + K.
Ctrl + U Deletes everything from the cursor backward to the start of the line.

In addition, the Shell supports the following keys and key combinations:

Space bar (or any printable character) Suspends output (stops scrolling).
Backspace Resumes output (continues scrolling).
Ctrl + C Sends a BREAK command to the current process (halts the process).
Ctrl + D Sends at BREAK command to the current script (halts the script).
Ctrl + F Activates and brings Workbench program windows to the front.
Ctrl + S Suspends output.
Ctrl + Q Resumes output if it was suspended with Ctrl+S.
Ctrl + \ /O is redirected to another device with * restores normal |/O.

The Shell allows you to enter a command or other information while listing output. However, this stops the output until you press the Return key. The new command executes after the output is finished listing.

If you enter a new command or text and then choose to delete it, the original output resumes scrolling as soon as the last character is erased.

Using the Command History

The Shell uses a 2 KB command line buffer to retain command lines, which provides a command history. Using this history you can recall previously entered command lines, edit them, and re-execute them. This lets you easily repeat a command or enter several similar commands. Figure 2-3 illustrates a series of commands stored in the command history buffer.

Command History Buffer

The exact number of lines retained in the command line buffer varies depending on the length of the lines actually stored. When the buffer is full, the oldest lines are removed. You can access lines in the buffer with the up and down arrow keys:

up arrow Moves backward in the history buffer (earlier lines).
down arrow Moves forward in the history buffer (later lines).

For example, you can copy several .info files from one directory to another by enteringthe full command line with the complete path only once and then recalling the lines as many times as necessary, changing only the file name.

You can also search for the most recent occurrence of a specific command by entering the command line, or the beginning of it, and pressing Shift+up arrow (or Ctrl+R). For example, if you enter DIR and press Shift+up arrow, you are returned to the last command entered to perform a DIR of any directory. Pressing Shift+down arrow goes to the bottom of the command history buffer, leaving the cursor on a blank line.

Copying and Pasting

You can copy and paste information from one console window, such as a Shell or ED window, to the same or another window. This done by selecting commands in the Edit menu, just like in most Amiga tools. Figure 2-4 illustrates copying and pasting from the Shell window to a Notepad window.

Use the mouse to highlight the area of text to be copied and pasted. Highlight the text to be copied by moving the pointer to the beginning of the text area, holding down the selection button, and dragging the mouse pointer to the end of the desired text. Release the selection button and press Right Amiga+C or select Copy from the Edit menu. The highlighted area is copied into the Clipboard and the area is unhighlighted. The text you copied can be repeatedly pasted into any application window that supports reading text from the Clipboard, such as the Shell, Notepad, and MultiEdit.

To position the cursor where you want to paste the text, move the mouse pointer to that location and click. Press right Amiga+V to paste the text.

Note
If a block of text is pasted into a Shell window, the Shell attempts to execute each line of the text as a command. This can have unpredictable results if the block of text has embedded returns and is not an AmigaDOS script.

Working with the Shell

The following are tips for speeding your work with the Shell.

Use command history and command line editing
It sometimes takes several attempts using the same command before getting it right, especially when you are first learning how to use AmigaDOS. Use the arrow keys to recall a previous command and change only the part of the line that causes the problem to eliminate the need to retype the entire line.
Use aliases
Defining short aliases for commands you use often is another time-saver. It also eliminates the need to remember a long and/or complex series of options. For complete instructions, see the ALIAS command in Chapter 6.
Omit unnecessary keywords
For clarity, AmigaDOS command names and keywords throughout this book are often shown although they are optional. When you learn a command's format, however, you seldom need to include optional keywords.
Do not use capital letters
Command names, keywords, and assigned directories are shown in all upper case letters throughout this manual even though AmigaDOS is case-indifferent. This is done to distinguish the keywords from the file names and other information on the example command line. There is no need to use capitalization, except in commands that create a file or directory whose name you want to appear capitalized.
Use implied CD
This allows you to leave out the CD command, saving three keystrokes. Enter the only directory name, path, colon, or slashes at the prompt to change directories. For more information about changing directories, see the CD command in Chapter 6.