clear bash history on logout, not [solved]

Forum rules
Before you post please read how to get help
Post Reply
SiKing
Level 5
Level 5
Posts: 570
Joined: Mon Sep 29, 2008 10:57 pm
Location: Las Vegas
Contact:

clear bash history on logout, not [solved]

Post by SiKing » Fri Jul 17, 2015 5:04 pm

Hello *.

I am running LM17.2. Whenever I close a terminal (logout) my bash history is cleared. How do I stop that?

This did not used to happen, but I am not sure what version this was introduced in. I searched through all the bash startup files, and there is a lot of them, and could find the culprit.

TIA for any leads.
Last edited by SiKing on Tue Jul 21, 2015 3:26 pm, edited 1 time in total.

Cosmo.
Level 23
Level 23
Posts: 17829
Joined: Sat Dec 06, 2014 7:34 am

Re: clear bash history on logout

Post by Cosmo. » Fri Jul 17, 2015 5:19 pm

Enter in a terminal

Code: Select all

ls -la .bash*
and paste the output here.

Also paste the content of the file .bashrc

Please use code-tags to enclose both outputs. How to: Mark the output here in the text editor field and click on the code-button on the top of the editor field.

SiKing
Level 5
Level 5
Posts: 570
Joined: Mon Sep 29, 2008 10:57 pm
Location: Las Vegas
Contact:

Re: clear bash history on logout, not

Post by SiKing » Fri Jul 17, 2015 5:43 pm

Code: Select all

$ ls -la .bash*
-rw------- 1 root root 1426 May  6 13:42 .bash_history
-rw-r--r-- 1 mark mark  220 Apr 30 09:31 .bash_logout
Is "root" the correct ownership for that? :?

I do not have a .bashrc, I only have the default startup files that come with the system: .profile, /etc/profile, and everything referenced from those. But they are only the default and unmodified files as they come out of the box.

Jamesc359
Level 3
Level 3
Posts: 150
Joined: Sun May 06, 2012 1:42 pm

Re: clear bash history on logout, not

Post by Jamesc359 » Sat Jul 18, 2015 3:30 am

Nope, that's wrong. A simple chown should fix your problem.

sudo chown mark:mark .bash_history
“Gosh, you've... really got some nice toys here.”

Cosmo.
Level 23
Level 23
Posts: 17829
Joined: Sat Dec 06, 2014 7:34 am

Re: clear bash history on logout, not

Post by Cosmo. » Sat Jul 18, 2015 4:55 am

The missing file .bashrc is no problem; it gets only created by user's will.

The question is, why the ownership is wrong. I admit, I have no idea.
Chances are, that there are more files or folders with wrong ownership. For a quick check enter in the terminal

Code: Select all

ls -la
There should be no file with anything else than mark:mark

Habitual
Level 13
Level 13
Posts: 4870
Joined: Sun Nov 21, 2010 8:31 pm
Location: 0.0.0.0

Re: clear bash history on logout, not

Post by Habitual » Sun Jul 19, 2015 9:29 am

Cosmo. wrote:Chances are, that there are more files or folders with wrong ownership. For a quick check enter in the terminal

Code: Select all

ls -la
I humbly suggest

Code: Select all

find ! -user mark -type f
for a list of them, if any.

Cosmo.
Level 23
Level 23
Posts: 17829
Joined: Sat Dec 06, 2014 7:34 am

Re: clear bash history on logout, not

Post by Cosmo. » Sun Jul 19, 2015 5:32 pm

I agree, Habitual.

The reason why I wanted at first to list only the content of ~ is, that I wanted to see a not so long list for the beginning, just to get an idea.

Habitual
Level 13
Level 13
Posts: 4870
Joined: Sun Nov 21, 2010 8:31 pm
Location: 0.0.0.0

Re: clear bash history on logout, not

Post by Habitual » Mon Jul 20, 2015 8:36 am

Cosmo. wrote:I agree, Habitual.

The reason why I wanted at first to list only the content of ~ is, that I wanted to see a not so long list for the beginning, just to get an idea.
As good of a start, as any!

Carry on!

SiKing
Level 5
Level 5
Posts: 570
Joined: Mon Sep 29, 2008 10:57 pm
Location: Las Vegas
Contact:

Re: clear bash history on logout, not [solved]

Post by SiKing » Tue Jul 21, 2015 3:21 pm

That's messed up. The file permissions were the issue!

FYI: the history is written to .bash_history when you exit a terminal. Since my permissions were messed up, the file could not be written to.

I run two separate machines: LM17-XFCE and LM17-Cinn. Both are fresh installs, and both have this problem. How did it get that way?

Cosmo.
Level 23
Level 23
Posts: 17829
Joined: Sat Dec 06, 2014 7:34 am

Re: clear bash history on logout, not [solved]

Post by Cosmo. » Tue Jul 21, 2015 3:28 pm

SiKing wrote:FYI: the history is written to .bash_history when you exit a terminal. Since my permissions were messed up, the file could not be written to.
We knew this already, as you can reread in the post from Jamesc359 3 days ago.
SiKing wrote:I run two separate machines: LM17-XFCE and LM17-Cinn. Both are fresh installs, and both have this problem. How did it get that way?
To find that out I gave you a piece of code in the following post (also 3 days ago). It is your task and decision to run it and show us the result (copy / paste).

SiKing
Level 5
Level 5
Posts: 570
Joined: Mon Sep 29, 2008 10:57 pm
Location: Las Vegas
Contact:

Re: clear bash history on logout, not [solved]

Post by SiKing » Wed Jul 22, 2015 2:01 pm

Cosmo. wrote:... It is your task and decision to run it and show us the result (copy / paste).
Whoa, dude, chill!

I was just trying to summarize things for anyone else that may be facing this problem.
As I said: I have two different LM17 editions, both fresh install, both with the same problem. I am guessing this is not a rare occurrence. I was hoping that someone would check theirs an reply with: "must be you", or "I have the same thing."
Also: there are no other files with incorrect permissions.

This community used to be slightly more welcoming when I joined seven years ago. :(

Post Reply

Return to “Scripts & Bash”