syntax for outputing past bash commands to a .txt file

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Larry Lauer
Date:  
Subject: syntax for outputing past bash commands to a .txt file
You could use tail -n (number of lines back) filename

ex : tail -n 3 .bash_history would show you the last 3 commands that you typed.

or something like this.

history > tail
tail -n 3 tail >last3

Hope this helps.

Larry

-----Original Message-----
From: Robert Bushman [mailto:bob@traxel.com]
Sent: Thursday, July 25, 2002 8:06 AM
To:
Subject: Re: syntax for outputing past bash commands to a .txt file


You can also use the "history" and "fc" commands, which
do all sorts of stupid pet tricks.

http://www.gnu.org/manual/bash-2.02/html_chapter/bashref_7.html

On Thu, 25 Jul 2002, Derek Neighbors wrote:

> .bash_history in your home directory
>
> -Derek
> On Thu, 25 Jul 2002 07:22:13 -0700 (PDT)
> Alpha Zenon Sanchez <> wrote:
>
> > 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?
> >
> > Thanks in advance,
> > Alpha Z Sanchez
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Health - Feel better, live better
> > http://health.yahoo.com
> > ________________________________________________
> > See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail
> > doesn't post to the list quickly and you use Netscape to write mail.
> >
> > PLUG-discuss mailing list -
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
>
> PLUG-discuss mailing list -
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>


--------------------------------------------------------------------
"We need commonsense judges who understand that our rights were
derived from God. Those are the kind of judges I intend to put on
the bench." President George W. Bush, 27 June 2002
http://www.nando.net/politics/story/453192p-3627921c.html

"no religious Test shall ever be required" Constitution Article 6
http://www.law.emory.edu/FEDERAL/usconst/art-6.html
--------------------------------------------------------------------


________________________________________________
See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.

PLUG-discuss mailing list -
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss