It is currently Thu, 20 Jan 2022 04:00:05 GMT

Author Message
 Unix "doskey"???
Not being a unix guru, and at the risk of offending by mentioning
a "Windows" program name in this forum, please allow me to ask a dumb

Are all unix users great typists, or what?

I've always been puzzled by (as far as I know) the lack of any kind
of "command history" program like the above, that will pull your last
command back up, so you can modify and re-submit it without having to
type the whole darn thing all over again!

So I ask:  Is there any such thing???

Of course, I know that I can "tail -<n> $HOME/.sh_history" (ksh) and
SEE what that last command was.  What I really want is to get that
command back on my input line (AFTER the prompt) in an editable form so
I can change it and press enter again!

Any suggestions?  Or, am I missing something really obvious?

Thanks for the help!

Kevin Arthur

Sent via

 Tue, 03 Jun 2003 13:40:30 GMT   
 Unix "doskey"???

In contrary, I feel very bored when having standard doskey on
MS-DOS. No file name completion.

In the default bash or tcsh, you can use the up and down arrows
to navigate through your history as in MS-DOS doskey.

You can also retrieve commands with patterns.
"!tel" might retrieve the command
"telnet my_far_host". It looks for the beginning of a command.
"!?far" does the same, but looks _not_ for the beginning.

There are a lot more features: retrieve by history number,
repeat last command, etc.

Additionally, you can use the tab for filename completion, what
standard doskey lacks.
If there is a file "my_file", you may type "my" and then <TAB>,
and the rest appears, if the file exists and if there are no
conflicts. In this case, a beep occurs.

In the default ksh, you have to setup command line editing with
vi or emacs commands. That's somewhat different from doskey.

-- avs

Andre van Straaten

The signs and the omens are everywhere
But too few see them - too few even care
(Lee Clayton - singer/songwriter, 1979)

 Tue, 03 Jun 2003 17:30:39 GMT   
 Unix "doskey"???

 karthur> I've always been puzzled by (as far as I know) the lack of any kind
 karthur> of "command history" program like the above, that will pull your
 karthur> last command back up, so you can modify and re-submit it without
 karthur> having to type the whole darn thing all over again!

 karthur> So I ask: Is there any such thing???

 karthur> Any suggestions?  Or, am I missing something really obvious?

Yes. Use a command shell that supports command history edition. Ksh does, but
I suggest you to check zsh.

Arto V. Viitanen                                        
University of Tampere, Department of Computer and Information Sciences
Tampere, Finland                            

 Tue, 03 Jun 2003 18:32:18 GMT   
 Unix "doskey"???

On some shells you can use "esc" + "k". Then just keep hitting "k" to scroll
through them.

Alternatively, if you have a three button or a wheel mouse, the middle
button can be used to paste highlighted text into the command line.


 Tue, 03 Jun 2003 21:40:54 GMT   
 Unix "doskey"???

of course, depending on what shell you use.

in tcsh, i can press the up-arrow key and progress backwards through
my command history.  when i reach the command i am interested in,
i can edit it if i want, and then re-execute it.

in any csh-based shell (csh, tcsh, and ksh, i think), there are all
kinds of history commands:

!!            repeat last command
!x            repeat most recent command that began with "x"
!?x?          repeat most recent command that had "x" anywhere in it
!5            repeat the fifth command
!5:s/x/y/     repeat the fifth command, BUT change "x" to "y"

much better than any mere DOSkey.

"... What with you being his parents and all, I think that you could
be trusted not to shaft him."  -- Robert Chang,

John Gordon                     

 Tue, 03 Jun 2003 23:36:03 GMT   
 Unix "doskey"???

Yse. Scenond qisteion pleaz

Like 'what above' - I see nothing above your first question.

Part the shell you used.

Since you brought up the name of the best editor, if you put
set -o vi in your startup initialization, or just type it,
then the default is ESC k - k being the typical up cursor movement.
Then you have the vi editing tools with which to edit the line.

Yes and yes.

Both answered above. :-)

Bill Vermillion -   bv @ wjv . com

 Wed, 04 Jun 2003 03:37:54 GMT   
 Unix "doskey"???
Thank you, thank you, thank you!!!

Being a newbie, I wasn't comfortable using a different shell.
We've got scripts and stuff set up, and I believe they're
dependent on running under ksh.

And, the "!" based commands didn't seem to work - at least
not on my system.  (Solaris 2.6/SunOS 5.6)

However, "set -o vi" works great!  And does exactly what
I wanted!!

(BTW, I could care less about "doskey" per se, I just wanted
the equivalent - or better - functionality, which I now have!)

Thanks everyone for your insights and suggestions!

Kevin Arthur

Sent via

 Wed, 04 Jun 2003 06:36:19 GMT   
 Unix "doskey"???
In AIX, when you enable set -o vi, the auto-completion won't work.
However, if I use set -o emacs it would work, but ESC k won't.
Is there a way to enable both at the same time?

Sent via

 Thu, 05 Jun 2003 18:18:06 GMT   
 Unix "doskey"???

If you use set -o emacs, you can type ^P instead of esc K.

 Fri, 06 Jun 2003 09:04:43 GMT   
 Unix "doskey"???

Sure it works.  It's just not esc-esc anymore.

Try esc-tab-\ while in you're in vi mode.  Or, if you prefer,
you can use ctrl-P to scroll back in your command history in
emacs mode.
                 Chris Mattern

 Sat, 07 Jun 2003 05:43:54 GMT   
   [ 10 post ] 

Similar Threads

1. GETSERVBYNAME()????????????????????"""""""""""""

2. "Novell-like","non-TCP/IP","networking" OS to place Unix

3. Why the "x" in the words "Unix", "Linux"...?

4. "Source Route Failed", "LOGIN FAIL..", "Malformed response", and "Lame server" messages in /var/log

5. "WaveRunner"/"Linux"/"OS/2 Warp"/"ISDN "

6. What's different among "syscall", "syscall32", "syscall3264", "syscall64"?

7. "Invited", "Free Gift", and the English Language

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software