Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Does anyone know the unix equivalent of the doskey command?

513 views
Skip to first unread message

mdsouza

unread,
Aug 11, 1997, 3:00:00 AM8/11/97
to

This has been bugging me,but I'm trying to figure out how to get
the cursor keys to scroll through previous commands(ie. like the doskey
utility).

Brian J. Uzwiak

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

You have to use a shell like tcsh that supports doskey-like functionality.

Gary R. Hook

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

Scott Overby wrote:
>
> mdsouza <mds...@ibm.net> wrote in article <33EFDE...@ibm.net>...

> > This has been bugging me,but I'm trying to figure out how to get
> > the cursor keys to scroll through previous commands(ie. like the doskey
> > utility).
>
> If using ksh, execute 'set -o vi'
> to scroll:
> back <ESC>k
> down <ESC>j

In emacs mode in the ksh, it's possible to map the arrow
keys to scroll through the list. This may or may not
be documented in Info, but it is possible. As I understand
it, it's not possible to map the arrow keys in vi mode.

--
________________________________________________________________________
Gary R. Hook | Next to being shot at and missed,
AIX Kernel Development, RS6000 Div. | nothing is really quite as
IBM Corporation, Austin, Texas | satisfying as an income tax
The above opinions are all mine. | refund. --R. J. Raymond

Peter Bjoern

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

"Gary R. Hook" <ho...@austin.ibm.com> wrote:

>Scott Overby wrote:
>>
>> mdsouza <mds...@ibm.net> wrote in article <33EFDE...@ibm.net>...
>> > This has been bugging me,but I'm trying to figure out how to get
>> > the cursor keys to scroll through previous commands(ie. like the doskey
>> > utility).
>>
>> If using ksh, execute 'set -o vi'
>> to scroll:
>> back <ESC>k
>> down <ESC>j
>
>In emacs mode in the ksh, it's possible to map the arrow
>keys to scroll through the list. This may or may not
>be documented in Info, but it is possible. As I understand
>it, it's not possible to map the arrow keys in vi mode.

I have the following notes from a previous post here :


Edit your .profile to export ENV=$HOME/.kshrc

Add theese lines to .kshrc:

alias __A="$(print '\020')"
alias __B="$(print '\016')"
alias __C="$(print '\006')"
alias __D="$(print '\002')"

Then do a :

set -o emacs

Now the arrow keys should work ...


I'm typing this at home, so I can't verify there are
no typos, but I have it working at the office.

Regards

Peter


Richard Eyles

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

In article <33EFDE...@ibm.net> mds...@ibm.net "mdsouza" writes:

> This has been bugging me,but I'm trying to figure out how to get
> the cursor keys to scroll through previous commands(ie. like the doskey
> utility).

I've found that "Esc-" works for me. Hit Esc once then each press
of - goes back one more command. I use ksh as my shell.

Cheers

--
Richard Eyles
Computer Services Pharmacist
Birmingham Heartlands Hospital, Birmingham UK


Scott Overby

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

mdsouza <mds...@ibm.net> wrote in article <33EFDE...@ibm.net>...

> This has been bugging me,but I'm trying to figure out how to get
> the cursor keys to scroll through previous commands(ie. like the doskey
> utility).
>

If using ksh, execute 'set -o vi'


to scroll:
back <ESC>k
down <ESC>j

then use vi edit keys to modify command.
--
==========================================================================
Scott Overby E-mail scott....@sdsdata.com
Sr. Systems Analyst Phone (414) 459-7999
Strategic Data Systems FAX (414) 459-9123
615 Penn Ave.
Sheboygan, WI 53082
===========================================================================

Andrew Gierth

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

>>>>> "Gary" == Gary R Hook <ho...@austin.ibm.com> writes:

>> mdsouza <mds...@ibm.net> wrote in article <33EFDE...@ibm.net>...
>> > This has been bugging me,but I'm trying to figure out how to get
>> > the cursor keys to scroll through previous commands(ie. like the doskey
>> > utility).

Gary> In emacs mode in the ksh, it's possible to map the arrow
Gary> keys to scroll through the list. This may or may not
Gary> be documented in Info, but it is possible. As I understand
Gary> it, it's not possible to map the arrow keys in vi mode.

*sigh*

Reposted yet again, here is the necessary incantation to get the
arrow keys working on a vaguely ANSI-ish terminal:

set -o emacs


alias __A="$(print '\020')"
alias __B="$(print '\016')"
alias __C="$(print '\006')"
alias __D="$(print '\002')"

Put this in your ENV file or somewhere similar.

--
Andrew.

Wim van der Wouden

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

On 12 Aug 1997 04:53:41 GMT, uzw...@tsongas.seas.ucla.edu (Brian J.
Uzwiak) wrote:

>mdsouza (mds...@ibm.net) wrote:
>> This has been bugging me,but I'm trying to figure out how to get
>> the cursor keys to scroll through previous commands(ie. like the doskey
>> utility).
>

>You have to use a shell like tcsh that supports doskey-like functionality.

Or ksh with an editor set. In that case you'll have some vi-like
possibilities to edit and relaunch previous commands.


Or dg/ux which has the capability in any shell to scroll backwards.

Wim van der Wouden
wv...@hertec.be
vdwo...@hertec.be

Al

unread,
Aug 13, 1997, 3:00:00 AM8/13/97
to

In article <33EFDE...@ibm.net>, mdsouza <mds...@ibm.net> wrote:

>This has been bugging me,but I'm trying to figure out how to get
>the cursor keys to scroll through previous commands(ie. like the doskey
>utility).

Try GNU Bash. It supports command history using arrow keys.

Al

--

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Alvin Koh <Alvi...@WriteMe.COM>

...Today's dreamers are tomorrow's achievers....ZZZZZZZZZZZ....

($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)-($$$)

Torben Slaikjer

unread,
Aug 13, 1997, 3:00:00 AM8/13/97
to

> In article <33EFDE...@ibm.net>, mdsouza <mds...@ibm.net> wrote:
>> This has been bugging me,but I'm trying to figure out how to get the cursor
>> keys to scroll through previous commands(ie. like the doskey utility).

> Try GNU Bash. It supports command history using arrow keys.

If you are using /bin/ksh, put set -o emacs in your .profile.
The you can use ctrl-p for prev. command, ctrl-b move back on line, ctrl-f
forward. See man ksh for the rest of the rest.

/torben

--
Torben Slaikjer
Kalmargade 61 st. th. Email: tor...@daimi.aau.dk
8200 Aarhus N Office V 4.28 +45 8942 4852
Phone: +45 86 16 56 11

Kieron Johnson

unread,
Aug 19, 1997, 3:00:00 AM8/19/97
to

Richard,

If using ksh add set -o vi or set -o emacs to your .profile or type it at
the command line. Both will give you the sort of functionality your looking
for though vi is much more powerfull. With emacs you press CTRL-N or P for
next, previous command and with vi ESC-K or J for next, previous. There's
alot more to these commands so have a look in InfoExplorer for example you
can search for commands, delete, insert overwrite etc.

Kieron
--
Kieron Johnson Protocol Solutions Limited
AIX System Specialist Fareham, Hants, England

Voice: +44 (0)1489 885950
Fax : +44 (0)1489 579361


<snip>


> > This has been bugging me,but I'm trying to figure out how to get
> > the cursor keys to scroll through previous commands(ie. like the doskey
> > utility).

<snip>


Al Aab

unread,
Aug 19, 1997, 3:00:00 AM8/19/97
to

set -o emacs
then
use ^p for previous line
^n for next line

or use bash shell


also

alias with a dash (-) or two (--)
supposedly, can redefine arrow keys
the man page is inaedquate
search the web (not easy)

also

u may like to delve into def your termainal keys (forgot the command name)


also, if using a modem connection,

u may like to delve into the arcane key redefs of vt100 et al


messy
?


Gary R. Hook (ho...@austin.ibm.com) wrote:
: Scott Overby wrote:
: >
: > mdsouza <mds...@ibm.net> wrote in article <33EFDE...@ibm.net>...
: > > This has been bugging me,but I'm trying to figure out how to get


: > > the cursor keys to scroll through previous commands(ie. like the doskey
: > > utility).

: >
: > If using ksh, execute 'set -o vi'


: > to scroll:
: > back <ESC>k
: > down <ESC>j

: In emacs mode in the ksh, it's possible to map the arrow
: keys to scroll through the list. This may or may not
: be documented in Info, but it is possible. As I understand
: it, it's not possible to map the arrow keys in vi mode.

: --

: ________________________________________________________________________
: Gary R. Hook | Next to being shot at and missed,
: AIX Kernel Development, RS6000 Div. | nothing is really quite as
: IBM Corporation, Austin, Texas | satisfying as an income tax
: The above opinions are all mine. | refund. --R. J. Raymond

--
=-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
al aab, seders moderator sed u soon
it is not zat we do not see the s o l u t i o n
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

Simon Travaglia

unread,
Aug 21, 1997, 3:00:00 AM8/21/97
to

mdsouza <mds...@ibm.net> wrote:
> This has been bugging me,but I'm trying to figure out how to get
> the cursor keys to scroll through previous commands(ie. like the doskey
> utility).

Someone (I don't know who) posted this, which is a dream come true:

(Whack it in you .kshrc or other ENV file)

alias __A="$(print '\020')"
alias __B="$(print '\016')"
alias __C="$(print '\006')"
alias __D="$(print '\002')"

--

Simon Travaglia, Email without auto spam rejection at s...@waikato.ac.nz
http://mrjolly.cc.waikato.ac.nz Ph: +64 7 838-4709 Fax: +64 7 838-4066
University of Waikato, Private Bag 3105, Hamilton, New Zealand..

Simon Taylor

unread,
Aug 26, 1997, 3:00:00 AM8/26/97
to

In my experience, this only works if you have set the ksh emacs
editing mode, ie:

set -o emacs

Those of us who prefer set -o vi are not so lucky!

--
Simon Taylor
Unisolve Pty Ltd Melbourne, Australia

Simon Travaglia <si...@mrjollylivesnextdoor.cc.waikato.ac.nz> wrote in
article <5tg2ab$h...@netserv.waikato.ac.nz>...

Thomas Jackson

unread,
Sep 2, 1997, 3:00:00 AM9/2/97
to simonS...@waikato.ac.nz

Simon Travaglia wrote:
>
> mdsouza <mds...@ibm.net> wrote:
> > This has been bugging me,but I'm trying to figure out how to get
> > the cursor keys to scroll through previous commands(ie. like the doskey
> > utility).
>
> Someone (I don't know who) posted this, which is a dream come true:
>
> (Whack it in you .kshrc or other ENV file)
>
> alias __A="$(print '\020')"
> alias __B="$(print '\016')"
> alias __C="$(print '\006')"
> alias __D="$(print '\002')"
>
> --
>
> Simon Travaglia, Email without auto spam rejection at s...@waikato.ac.nz
> http://mrjolly.cc.waikato.ac.nz Ph: +64 7 838-4709 Fax: +64 7 838-4066
> University of Waikato, Private Bag 3105, Hamilton, New Zealand..

I am familiar with two methods which I believe are part of Korn shell.

EMACS MODE: Add the following line to your ENV file ( or type at command
line ):

set -o emacs

Then the following keystrokes will work:

^p (control p) = previous command
^n = next command
^a = move to beginning of line
^e = move to end of line
^b = move back one character
^f = move forward one character
^d = delete one character at cursor
^k = delete from cursor to end of line
^rstring = search for a previous command which includes "string"

VI MODE: Add the following line to your ENV file ( or type at command
line ):

set -o vi

Press Esc to start command line edit mode; then vi keystrokes work on
the command line. For example:

h = left one character
4h = left four characters
l = right one character
x = delete one character
cw = change from cursor to end of word
C = change from cursor to end of line
i = insert
a = append at cursor
A = append to end of line
k or - = fetch previous command
j or + = fretch next command
/string = search previous commands for "string"

There are lots more.

0 new messages