One of my favourite program is rlwrap. This program could be used as a «wrapper» for other programs where I wish to use the arrows keys for easy editing of text in the same way you may have seen while using the command window in windows (cmd).
The program has already been compiled if working with Ubuntu Linux, all you need is to download the program from the net:
oracle@ubuntu: ~ $ sudo apt-get install rlwrap
...
Some other Linux or Unix dialects do have a similar approach. However, you may have to compile the program yourself.
Use your favourite search engine to locate an appropriate site where you can download the source code for rlwrap. Go ahead and compile the code:
[oracle@linux tmp]$ tar xvzf rlwrap-0.30.tar.gz
rlwrap-0.30/
rlwrap-0.30/completions/
rlwrap-0.30/completions/ftp
...
[oracle@linux tmp]$ cd rlwrap-0.30
/tmp/rlwrap-0.30
[oracle@linux rlwrap-0.30]$ ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
...
config.status: creating distribution/rlwrap.spec
config.status: creating config.h
config.status: executing depfiles commands
Now do:
make (or gmake) to build rlwrap
make check for instructions how to test it
make install to install it
[oracle@linux rlwrap-0.30]$ make
make all-recursive
make[1]: Entering directory `/tmp/rlwrap-0.30'
Making all in doc
/tmp/rlwrap-0.30/doc
make[2]: Entering directory `/tmp/rlwrap-0.30/doc'
sed -e 's#@DATADIR@#/usr/local/share#' rlwrap.man > rlwrap.1
make[2]: Leaving directory `/tmp/rlwrap-0.30/doc'
Making all in src
[oracle@linux rlwrap-0.30]$ sudo make install
Password: ######
Making install in doc
/tmp/rlwrap-0.30/doc
make[1]: Entering directory `/tmp/rlwrap-0.30/doc'
make[2]: Entering directory `/tmp/rlwrap-0.30/doc'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/man/man1" || /bin/mkdir -p "/usr/local/share/man/man1"
/usr/bin/install -c -m 644 './rlwrap.1' '/usr/local/share/man/man1/rlwrap.1'
make[2]: Leaving directory `/tmp/rlwrap-0.30/doc'
make[1]: Leaving directory `/tmp/rlwrap-0.30/doc'
Making install in src
/tmp/rlwrap-0.30/src
make[1]: Entering directory `/tmp/rlwrap-0.30/src'
make[2]: Entering directory `/tmp/rlwrap-0.30/src'
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
/usr/bin/install -c 'rlwrap' '/usr/local/bin/rlwrap'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/rlwrap-0.30/src'
make[1]: Leaving directory `/tmp/rlwrap-0.30/src'
make[1]: Entering directory `/tmp/rlwrap-0.30'
make[2]: Entering directory `/tmp/rlwrap-0.30'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/rlwrap" || /bin/mkdir -p "/usr/local/share/rlwrap"
/usr/bin/install -c -m 644 'completions/ftp' '/usr/local/share/rlwrap/ftp'
/usr/bin/install -c -m 644 'completions/testclient' '/usr/local/share/rlwrap/testclient'
/usr/bin/install -c -m 644 'completions/coqtop' '/usr/local/share/rlwrap/coqtop'
make[2]: Leaving directory `/tmp/rlwrap-0.30'
make[1]: Leaving directory `/tmp/rlwrap-0.30'
[oracle@linux rlwrap-0.30]$ which rlwrap
/usr/local/bin/rlwrap
You may have to download a few more libraries if that is not done already for your system in order to get rlwrap to compile.
[oracle@linux tmp]$ tar xvzf readline-5.2.tar.gz
readline-5.2/
readline-5.2/doc/
readline-5.2/doc/Makefile.in
...
[oracle@linux readline-5.2]$ cd readline-5.2
/tmp/readline-5.2
[oracle@linux readline-5.2]$ ./configure
[oracle@linux readline-5.2]$ make
[oracle@linux readline-5.2]$ sudo make install
[oracle@linux readline-5.2]$ sudo ldconfig
Having compiled and installed rlwrap leads us to the next step. Add some aliases to for instance .bashrc is handy. Use rlwrap in all programs where it is relevant. Here are a few examples:
ingemar@linux: ~ $ cd
ingemar@linux: ~ $ vi .bashrc
alias sql='sqlplus "/ as sysdba"'
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias dgmgrl='rlwrap dgmgrl'
alias boston='. ~/.boston'
alias chicago='. ~/.chicago'
alias emrep='. ~/.emrep'
alias test10g='. ~/.test10g'
alias test11g='. ~/.test11g'
alias ll='ls -ltr'
Finally, test the aliases and see how it works.
Good Luck!