|
|
| |
 |
|
The UNIX command line editor
Oracle Tips by Burleson Consulting
|
The UNIX command line editor
In UNIX, your login profile file (.profile, .kshrc) issues UNIX
commands at login time to allow you to easily navigate in UNIX. The
commands in your logon profile set your terminal type, your command
line editor, and other shortcuts that make UNIX navigation easy.
The most important command is the set –o command because it defines
the command line editor. Let’s take a closer look at how the command
line editor makes you life in UNIX easier.
UNIX allows you to set the type of command editor. Once set, you can
use a variety of shortcuts to quickly re-display previous UNIX
commands. These shortcut commands will greatly reduce the amount of
typing at the UNIX prompt, and you can always recognize a UNIX guru
because of their use of these command shortcuts. There are two
common settings for the command line editor, emacs and vi.
set – o emacs – This command sets the emacs editor
for editing online UNIX commands.
Command completion – the emaces setting allows you
to complete long file name by pressing the escape key twice (
<esc><esc>). For example, to vi the file
oracle_script_for_checking_permissions.ksh, you could enter vi
oracle <esc><esc>, and the command line will display:
root> vi
oracle_script_for_checking_permissions.ksh
Display previous commands – the emacs editor allow
you to view prior command by pressing the <ctrl> p keys.
set –o vi – This command sets the vi editor for
online UNIX commands. Once a command is displayed at the UNIX prompt
you can use standard vi commands to edit the command. In addition,
the set –o vi command allows for easy searches of the UNIX command
history:
Command completion – the vi setting allows you to
complete long file name by pressing the escape backslash ( <esc> \).
For example, to vi the file
oracle_script_for_checking_permissions.ksh, you could enter vi
oracle <esc> \, and the command line will display:
root> vi
oracle_script_for_checking_permissions.ksh
Display previous commands – the vi editor allow you
to view prior command by pressing the <esc> k key.
Search the command history – You can search for a
specific command in your command history and display it on your
command line by pressing the escape key and the forward slash (
<esc> / ). For example, to re-display a command that contains ksh,
you would enter <esc> /, followed by ksh. The matching command will
then be displayed on your command line.
To automatically set this value, you can place the following code in
your login file (.profile, .kshrc, .cshrc) :
#*****************************************************************
# Backspace and Keyboard editor setting
# This setting allows the following shortcuts:
# <esc> k to display command history
# <esc> \ for command completion
# <esc> / searchstring to find a command in the history file
#*****************************************************************
stty erase ^?
set -o vi
export EDITOR=vi
Once you have set your basic UNIX environment, you are ready to look
at setting your UNIX environment for Oracle.
 |
Expert Remote DBA
BC is America's oldest and largest Remote DBA Oracle support
provider. Get real Remote DBA experts, call
BC Remote DBA today. |
 |
|
|
|
|