Entering text at the command line allows you to perform ad hoc analysis, compile and launch applications, and create $MAIN$ programs. IDL provides some valuable command line functionality to support these tasks. See the following sections for details.

Copying and Pasting Multiple IDL Code Lines

You can paste multiple lines of text from the clipboard to the command line. You need to place some text in the clipboard and paste it into the command line. Any source of text is valid, with emphasis on the requirement that the text be convertible to ASCII.

When you are using the tty-based command line version of IDL and you paste multiple lines, make sure that they contain only a single IDL command or are statements containing line continuation characters ($). Multi-line statements will produce unintended IDL interpreter behavior or errors. Lines are transferred to the command line as is. Namely, leading white space is not removed and comment lines are sent to the IDL interpreter without distinction.

If you are using the IDL Workbench, you can paste multiple statements directly into the command line. You can also drag single or multiple lines from the Command History view to the command line.

Recalling Commands

By default, IDL saves the last 500 commands entered in a recall buffer. These command lines can be viewed, edited, and re-entered. The Command History view to the right of the Console displays the command history, organized by day.

You can re-use and edit commands by recalling them on the Command Line. The up-arrow key on the keypad recalls the previous command you entered to IDL. Pressing it again recalls the previous line, moving backward through the command history list. The down-arrow key on the keypad moves forward through the command history.

Note: Using the HELP procedure with the RECALL_COMMANDS keyword displays the entire contents of the recall buffer in the IDL Console.

Command recall is always available in the IDL Workbench. The command recall feature is enabled for the tty-based command-line version of IDL by setting the IDL_EDIT_INPUT preference to true, which sets the system variable !EDIT_INPUT to a non-zero value (the default is 1). See !EDIT_INPUT for details.

Changing the Number of Lines Saved

You can change the number of command lines saved in the recall buffer by setting the IDL_RBUF_SIZE preference equal to a number other than one (in the IDL Workbench, you can set this value via the General tab of the IDL Workbench Preferences dialog as well.)

Special Command Line Characters

Commands entered at the IDL prompt are usually interpreted as IDL statements to be executed. Other interpretations include executive commands that control execution and compilation of programs, shell commands, and so on. Input to the IDL prompt is interpreted according to the first character of the line, as shown in the following table.

Note: The information in this section applies equally to IDL used in command-line mode or in the IDL Workbench.

First Character



Executive command. See About Executive Commands for details.


Help inquiry. For example, enter ? on the Command Line to open the online help system. Enter ? .RUN to open the Help system to the page that explains the .RUN command.


Send an operating system commands to a subprocess.

The SPAWN procedure is a more flexible alternative. It need not be used interactively and the standard output of the command can be saved in an IDL string array. See SPAWN for details.


Batch file initiation.

up arrow key

Recall/edit previous commands.


In UNIX command-line mode, exits IDL, closes all files, and returns to operating system.


In UNIX command-line mode, suspends IDL.

All others

IDL statement.

About Executive Commands

IDL executive commands compile programs, continue stopped programs, and start previously compiled programs. All of these commands begin with a period and must be entered in response to the IDL prompt. Commands can be entered in either uppercase or lowercase and can be abbreviated. Under UNIX, filenames are case sensitive; under Microsoft Windows, filenames can be specified in any case. See Executive Commands for a descriptions of the available executive commands.

Note: Comments (prefaced by the semicolon character in IDL code) are not allowed within executive commands.

Executive commands are used to create $MAIN$ programs. See Creating $MAIN$ Programs for details.

Special Command Line Key Combination

When working at the command line, key combinations can be used to quickly edit a command. The line-editing abilities and the keys that activate them differ somewhat between the different operating systems. To access the history of commands entered at the command line, see Recalling Commands.

Note: The behavior can also differ within the same operating system, between the terminal window‑based command line version of IDL and the command line in the IDL Workbench.

The table below lists the edit functions and the corresponding keys in the terminal window (Command Line) and Workbench versions of IDL.


IDL Command Line

IDL Workbench

Move cursor to start of line

CTRL+A or Home

CTRL+A or Home

Move cursor to end of line

CTRL+E or End

CTRL+A or Home

Move cursor left one character

Left arrow

Left arrow

Move cursor right one character

Right arrow

Right arrow

Move cursor left one word

(R13 on Sun Keyboard)

CTRL+left arrow

Move cursor right one word

(R15 on Sun Keyboard)

CTRL+right arrow

Delete from current to start of line



Delete from current to end of line



Delete current character


CTRL+X or Delete

Delete previous character

CTRL+H, or Backspace, or Delete


Delete previous word

CTRL+W, or ESC-Delete


Generate IDL keyboard


(when a program is running)

Move back one line in
recall buffer

CTRL+N, Up arrow

Up arrow

Move forward one line in
recall buffer

Down arrow

Down arrow

Redraw current line






EOF if current line is
empty, else EOL



Search recall buffer for text

Available only in command-line mode. Enter ^ , then input search string at prompt.


Tab command matching

Available only for Windows.

After entering a few characters, press Tab to cycle through all the matching commands in the command history.

After typing a few characters, press Tab to cycle through all the matching commands in the command history.

Insert the character at the current
Executive Commands position

any character

any character

Parenthesis matching


Place cursor outside of parenthesis and IDL highlights the matching parenthesis.