|
Home > Archive > Unix Shell > January 2006 > Where is the history stored (bash)?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Where is the history stored (bash)?
|
|
| bob the builder 2006-01-21, 2:49 am |
| I know that it is written to ~/.bash_history when you log out, but
where is it stored befor it is written there?
| |
| No_One 2006-01-21, 2:49 am |
| On 2006-01-21, bob the builder <ewaguespack@gmail.com> wrote:
> I know that it is written to ~/.bash_history when you log out, but
> where is it stored befor it is written there?
>
memory
ken
| |
| bob the builder 2006-01-21, 2:49 am |
| ....
ok, where?
which environment variable?
where in proc?
say for example I wanted to clear my history for my current session
only, so that it doesn't end up in ~/.bash_history, how do i?
i realize I could script it, but i don't want to do that, I would very
much like to know exactly where the current shell sessions history is
stored, and how to manipulate it.
| |
| No_One 2006-01-21, 7:49 am |
| On 2006-01-21, bob the builder <ewaguespack@gmail.com> wrote:
> ...
>
>
> ok, where?
again memory
> which environment variable?
none that I'm aware of
> where in proc?
not that I'm aware of
> say for example I wanted to clear my history for my current session
> only, so that it doesn't end up in ~/.bash_history, how do i?
>
> i realize I could script it, but i don't want to do that, I would very
> much like to know exactly where the current shell sessions history is
> stored, and how to manipulate it.
Not necessarily, history commands are not well supported in scripts
at the command line
info bash
there's a large section on using history
Just a note: If you're going to use google groups to post, make sure you
included some of the previous post so others know what you're talking about..
ken
| |
| bob the builder 2006-01-21, 7:49 am |
| >> which environment variable?
>none that I'm aware of
[vbcol=seagreen]
>not that I'm aware of
>Just a note: If you're going to use google groups to post, make sure you
>included some of the previous post so others know what you're talking about..
>ken
no problem.
a note back to you:
if you are going to respond to peoples questions, make sure you have
some knowledge that allows you to formulate a better response than "one
that I'm aware of"
-op
| |
| Michael Heiming 2006-01-21, 7:49 am |
| In comp.unix.shell bob the builder <ewaguespack@gmail.com>:
> ...
> ok, where?
It's in memory.
> which environment variable?
> where in proc?
> say for example I wanted to clear my history for my current session
> only, so that it doesn't end up in ~/.bash_history, how do i?
'man history' opens the BASH_BUILTINS(1) man page on my box which
contains the 'history' options to do so.
[..]
BTW
Please read this before posting anything else:
http://cfaj.freeshell.org/google
--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | PERL -pe 'y/a-z/n-za-m/'
#bofh excuse 33: piezo-electric interference
| |
| No_One 2006-01-21, 7:49 am |
| On 2006-01-21, bob the builder <ewaguespack@gmail.com> wrote:
>
>
>
>
>
>
> no problem.
>
> a note back to you:
> if you are going to respond to peoples questions, make sure you have
> some knowledge that allows you to formulate a better response than "one
> that I'm aware of"
Here's a hint, when you find yourself compelled to give instructions to
someone on how to answer your questions, make sure you understand the
concept of sarcasm first..
ken
| |
| Michael Heiming 2006-01-22, 6:10 pm |
| In comp.unix.shell bob the builder <ewaguespack@gmail.com>:
[vbcol=seagreen]
[vbcol=seagreen]
[vbcol=seagreen]
[vbcol=seagreen]
[vbcol=seagreen]
[vbcol=seagreen]
> no problem.
> a note back to you:
> if you are going to respond to peoples questions, make sure you have
> some knowledge that allows you to formulate a better response than "one
> that I'm aware of"
A note back to you:
*PLONK*
--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | PERL -pe 'y/a-z/n-za-m/'
#bofh excuse 22: monitor resolution too high
| |
| Chris F.A. Johnson 2006-01-22, 6:10 pm |
| On 2006-01-21, bob the builder wrote:
> ...
>
> ok, where?
Where is what?
> which environment variable?
For what? Please read <http://cfaj.freeshell.org/google>.
> where in proc?
What's proc, and why does it matter?
> say for example I wanted to clear my history for my current session
> only, so that it doesn't end up in ~/.bash_history, how do i?
history -c
> i realize I could script it, but i don't want to do that, I would very
> much like to know exactly where the current shell sessions history is
> stored, and how to manipulate it.
It is stored in memory. You can view the entire history with the
history command, or read individual lines with UpArrow or ^P, or
search for lines with ^R.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
| |
| Robert Bonomi 2006-01-22, 6:10 pm |
| In article <1137835021.045646.231170@g47g2000cwa.googlegroups.com>,
bob the builder <ewaguespack@gmail.com> wrote:
>if you are going to respond to peoples questions, make sure you have
>some knowledge that allows you to formulate a better response than "one
>that I'm aware of"
>
Ok, asslhole, I'll oblige.
The history is not stored in *any* environment variable.
It that clear enough for you to understand?
| |
| bob the builder 2006-01-23, 6:13 pm |
| > Ok, asslhole, I'll oblige.
> The history is not stored in *any* environment variable.
> It that clear enough for you to understand?
the problem is, it is clearly stored somewhere, and you don't know
where, yet you feel compelled to respond with an "answer".
you are just making background noise, if you don't know, just keep that
hole in your face shut. (metaphorically speaking of course...)
simple =)
I tell you what, I will find the answer, and I'll come back here and
clue you in.
| |
| bob the builder 2006-01-23, 6:13 pm |
|
Chris F.A. Johnson wrote:
>
>
> What's proc, and why does it matter?
um, perhaps I should have not bought your book.
/proc : Kernel and process information virtual filesystem
The proc filesystem is the de-facto standard Linux method for handling
process and system information, rather than /dev/kmem and other similar
methods. We strongly encourage this for the storage and retrieval of
process information as well as other kernel and memory information.
>
>
> history -c
>
please read the question next time, I don't want to clobber
..bash_history
>
> It is stored in memory. You can view the entire history with the
> history command, or read individual lines with UpArrow or ^P, or
> search for lines with ^R.
>
no shit?
what does the F. A. stand for?
a few possibilities come to mind...
> --
> Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
> Shell Scripting Recipes: | My code in this post, if any,
> A Problem-Solution Approach | is released under the
> 2005, Apress | GNU General Public Licence
| |
| Chris F.A. Johnson 2006-01-23, 6:13 pm |
| Reply-To: cfajohnson@gmail.com
User-Agent: slrn/0.9.8.1 (Linux)
Date: Mon, 23 Jan 2006 17:38:36 -0500
Message-ID: <cg2ga3-9dk.ln1@teksavvy.com>
Lines: 50
NNTP-Posting-Host: 206.248.139.163
X-Trace: sv3- CxqbDdaLShBLk9x7sV4EAkL6fDYogK90rwEwKCWP
x4DcGyJujQpajoGPBpl3rf/ vCvviKk+68OLmNnG!Q0n6YoZ7fszP2rn3EOQeEna
lmvIO0q+8KJ+CW7TNc2HszZpw8zDmAKdHp9Ya29p
inFYFxw==
X-Complaints-To: abuse@teksavvy.com
X-DMCA-Complaints-To: abuse@teksavvy.com
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Xref: number1.nntp.dca.giganews.com comp.unix.shell:177994
On 2006-01-23, bob the builder wrote:
>
> Chris F.A. Johnson wrote:
>
>
> um, perhaps I should have not bought your book.
>
> /proc : Kernel and process information virtual filesystem
>
> The proc filesystem is the de-facto standard Linux method for handling
This is not a Linux group. Many versions of Unix do not have a
/proc pseudo filesystem.
>
> please read the question next time,
What question? Please quote relevant context.
> I don't want to clobber .bash_history
It doesn't; it just clears the history in memory.
Perhaps you don't have $HISTFILESIZE set to a large enough number.
Mine is set to 500000.
>
> no shit?
>
> what does the F. A. stand for?
>
> a few possibilities come to mind...
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
| |
| bob the builder 2006-01-23, 6:13 pm |
| >
>
I think I figured out this part, if you:
unset HISTFILE
the shell will not write to ~/.bash_history when your session
terminates
"If HISTFILE is unset, or if the history file is unwritable, the
history is not saved."
http://www.gnu.org/software/bash/manual/bashref.html
| |
| Chris F.A. Johnson 2006-01-23, 6:13 pm |
| On 2006-01-23, bob the builder wrote:
>
>
> I think I figured out this part, if you:
>
> unset HISTFILE
>
> the shell will not write to ~/.bash_history when your session
> terminates
That doesn't clear your history; it prevents bash from writing it
to your history file when you log out.
> "If HISTFILE is unset, or if the history file is unwritable, the
> history is not saved."
> http://www.gnu.org/software/bash/manual/bashref.html
>
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
| |
| Robert Bonomi 2006-01-23, 6:13 pm |
| In article <1138053473.880731.7080@g14g2000cwa.googlegroups.com>,
bob the builder <ewaguespack@gmail.com> wrote:
>
>
>the problem is, it is clearly stored somewhere, and you don't know
>where, yet you feel compelled to respond with an "answer".
Wrong, *again*, XXXXXXX.
I _do_ know where -- and the answer is "where you can't get at it".
>
>you are just making background noise, if you don't know, just keep that
>hole in your face shut. (metaphorically speaking of course...)
>
>simple =)
>
>I tell you what, I will find the answer, and I'll come back here and
>clue you in.
*Snicker* <guffaw> ROTFLMAO
I've got the actual source-code.
You can't tell me -anything- abou it that's not "already in there".
BTW, I've merely been doing programming for nearly 40 years.
>
| |
| bob the builder 2006-01-23, 6:13 pm |
| > > I don't want to clobber .bash_history
>
> It doesn't; it just clears the history in memory.
>
> Perhaps you don't have $HISTFILESIZE set to a large enough number.
> Mine is set to 500000.
>
ok, I thought history -c clobbered your existing .bash_history file.
I was under the false impression that it did.
so I was wrong; and have been schooled
I am still not quite clear how your $(history) can contain the contents
of your .bash_history, and your current sessions events... for example
how does it differentiate from the old and the new when the session
closes? I guess what I was looking for was something like this:
cat /etc/bash_logout
history >> ~./bash_history
so all this would make sense.... I guess I need to learn C.
thanks.
| |
| Chris F.A. Johnson 2006-01-23, 6:13 pm |
| On 2006-01-23, bob the builder wrote:
>
> I am still not quite clear how your $(history) can contain the contents
> of your .bash_history, and your current sessions events...
It doesn't.
> for example how does it differentiate from the old and the new when
> the session closes?
The history command deals only with the history in memory (except
for those options that read or save to $HISTFILE).
> I guess what I was looking for was something like this:
>
> cat /etc/bash_logout
> history >> ~./bash_history
The output of the history builtin is not in the same format as the
.bash_history file.
> so all this would make sense.... I guess I need to learn C.
What for?
It would help if you explained exactly what you want to do. Then we
could provide more specific information.
Here is the ouput of "help history", somewhat reformatted for
easier reading:
history [-c] [-d offset] [n]
history -awrn [FILENAME]
history -ps arg [arg...]
Display the history list with line numbers. Lines listed with with
a `*' have been modified.
N list only the last N lines.
-c causes the history list to be cleared by deleting all of the
entries.
-d deletes the history entry at offset OFFSET.
-a append history lines from this session to the history file.
-w writes out the current history to the history file;
-r read the file and append the contents to the history list
instead.
-n read all history lines not already read from the history file
and append them to the history list.
If FILENAME is given, then that is used as the history file else
if $HISTFILE has a value, that is used, else ~/.bash_history.
-s the non-option ARGs are appended to the history list as a
single entry.
-p perform history expansion on each ARG and display the result,
without storing anything in the history list.
If the $HISTTIMEFORMAT variable is set and not null, its value is
used as a format string for strftime(3) to print the time stamp
associated with each displayed history entry. No time stamps are
printed otherwise.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
| |
| bob the builder 2006-01-23, 6:13 pm |
| > >> Ok, asslhole, I'll oblige.
> Wrong, *again*, XXXXXXX.
> *Snicker* <guffaw> ROTFLMAO
> I've got the actual source-code.
> BTW, I've merely been doing programming for nearly 40 years.
Damn, you are old... don't get too excited, its open source, I'd hate
for you to have a heart attack.
|
|
|
|
|