syntax for outputing past bash commands to a .txt file

der.hans plug-discuss@lists.plug.phoenix.az.us
Thu, 25 Jul 2002 09:36:00 -0700 (MST)


Am 25. Jul, 2002 schwätzte Alpha Zenon Sanchez so:

> I know I've seen it before on the internet somewhere
> or perhaps it was this discussion group.  I can't
> recall...
>
> My question is this:
>
> What's the exact syntax to print to a text file, a
> history of commands you've typed on the command shell?
>
> Or is there a file in my OS (Mandrake 8.1) where I can
> view like say....my last 20 or so commands?

bash throws your old commands into .bash_history, but if you run multiple
shells it won't catch the commands from each shell.

In the default setup <ctrl>-p will give you previous commands and <ctrl>-r
will allow you to search your previous commands. The default setup is
emacs-style, so you can use lots of emacs commands to edit your command
line.

The command 'history' will print out your command history for the shell your
using.

If you've setup your shell to use vi-style command line editing then hitting
<esc> lets you go into 'command mode' and 'k' will go back through your
history and '/' will allow you to search it.

ciao,

der.hans
-- 
#  https://www.LuftHans.com/
#  Use PLUG form to get into the Phoenix IT Business Expo Thu and Fri.
#  https://www.LuftHans.com/tmp/ITBizExpoTixForm.html
#  The Internet is the front line of the battle
#  to protect our freedom. -- Nathaniel Borenstein