Previous Table of Contents Next

Vi Editing Mode

To edit commands saved in your history file simply press the Escape key. You are now in vi command mode. If you want to make a correction to the previous command simply press k. Now move around on the line using vi commands. Make changes to the line then press Return. You don't have to press Esc before pressing Return.

For further information about editing the history file using vi commands refer to Module 50.

The vi editor is described in Module 151.


There are two types of UNIX commands: internal and external commands. Internal commands are part of the ksh. They are executed within the shell itself. No new process has to be spawned, no code has to be read from disk and loaded into memory, and no PATH searching is performed. Therefore, internal commands are executed much faster than external commands.

Except for the following two internal commands, all internal commands have been placed in a module of their own name or in the Programming Constructs module.

. The dot command. The dot command executes a shell script in the current environment. The shell script is read just as if you had typed all the lines at your terminal, without a new child process being started. Usually, a shell script is executed in a subshell (a child process is started) and changes to the environment do not affect the current shell. The dot command circumvents this restriction. Therefore, any environmental changes made in the shell script executed by the dot command will be reflected in the current shell environment.
: The colon command. The colon command is the same as the true command. It does nothing. It always returns a 0 exit status. It is often used in while loops or if statements to fill a required command position. For example,
                       while :
                       echo "Stuck in an infinite loop."
is just one of many ways to use the colon command.

C Shell
The C shell uses the source command to perform the dot (.) command function used by the ksh.


The procedures that are followed by the shell to execute a command are described in Module 23.


Users often have the problem of the shell appearing to be hung or not responding. There are several situations to be aware of and solutions to each.

The first situation is the Ctrl-S and Ctrl-Q dilemma. If you type input on the keyboard and there is no response, first press Ctrl-Q to resume output to your terminal. If this does not work, the system may be extremely slow, in which case you must be patient.

Another possibility is the shell or last program you executed is hung. Try pressing Delete two or three times. If you are in applications, you might try pressing Esc or Ctrl-D depending on the application's required interrupt or attention key.


Refer to the following modules.

Module Module Name Module Module Name

  4 alias 104 popd
  9 bg 106 print
14 cd 107 printenv
23 Commands 108 Programming Constructs
38 echo 110 pushd
41 env 111 pwd
42 eval 112 read
44 exec 113 Regular Expressions
45 exit 118 set
47 export 119 setenv
49 false 120 shift
50 fc 121 sleep
51 fg 125 stop
54 Filenames 129 suspend
59 getopts 136 time
64 history 137 times
67 I/O and Redirection 141 trap
68 jobs 142 true
70 kill 145 typeset
73 let 146 ulimit
74 line 147 umask
92 newgrp 152 wait
94 nice 156 whence
96 nohup 157 whereis
99 pack 158 which


The following list describes the files the ksh command uses.

standard input Reads from the terminal keyboard or the output of a pipe.
standard output Writes to the terminal screen or the input of a pipe.
standard error Writes errors to the terminal screen or the input of a pipe.
/etc/profile Executes the commands stored in this file during login to perform common system login procedures.
/etc/alias Executes the commands stored in this file during login to set up common aliases.
$HOME/.profile Executes the commands stored in this file during login to set up user-defined environment.
$ENV Executed each time a new ksh is spawned.
Used for the history file, some implementations use sh* instead of ksh*.
/dev/null The system trash can, used to dump unwanted output.
/etc/passwd Used to find home directories for ~name substitutions.

Previous Table of Contents Next