[NBLUG/talk] Install fest & Linux history file if any

Andrew argonaut at gmx.co.uk
Fri Mar 23 18:48:05 PDT 2007


Marty Kamp wrote on Sun, 18 Mar 2007 11:49:38 -0700:

> I had the idea that maybe Ubuntu somewhere
> keeps a log of the keyboard activity. That would help me to
> re-create the process, which I may need to repeat when I
> install Ubuntu 7.xx or get a new laptop.

You're in luck, Marty. Well... maybe. The bash shell does keep a
log of past commands that you've issued. This file is called
".bash_history" (note the preceding dot -- if you don't know
about "dot files", you may want to google for that term) and
it's located in your home directory. It keeps a history of
recent commands (by default the last 500, but that can be
changed) that you've typed at the command line.

If you haven't done a large amount of command line work since
your system was installed, the commands you want may still be
in .bash_history. Do this:

1. If you are not logged in as the computer administrator (the
first user that you created when you installed Ubuntu), become
that user by whatever means you like. I assume the configuration
you're talking about was done as this user.

2. Make sure you are in the administrator's home directory by
typing "cd" (without the quotes) at the command line.

3. Make a copy of the .bash_history file with a command like
this:    cp .bash_history bash_history_from_install
Note that the name of the file to which you're copying doesn't
have a dot. There's no real need to hide the new file by using a
preceding dot.

4. If you think the new file might contain commands that others
shouldn't see, make sure it's readable and writable only by the
administrator:    chmod 600 bash_history_from_install

5. Look in the new file for the commands you want. For this you
can use a text editor (graphical or console) or command line
tools like more, less, or grep.

Hope this helps.

A.



More information about the talk mailing list