/home/user folder crowded with .bash_history-xxxxx.tmp

I’m not the best person to advise on this as I clear my bash history every day (note that in the article linked by @fred666 it states at the end "However, it’s good security practice to monitor what sensitive information this unlimited Bash history may contain).

Also, how long ago did you install EndeavourOS? cat ~/.bashrc for me on a recent install is only the following:

Summary
#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '

plus a couple of aliases that I’m keeping to myself :male_detective:

So, one of the questions you may need to ask yourself is what are you doing with your bash history? Are you accessing previous commands you have entered regularly?

This may guide you towards what limits to set - if you decide that a long running bash history is useful to you.

1 Like

In the case you choose unlimited for sure.

I limited mine to this

export HISTFILESIZE=2000
export HISTSIZE=1000
3 Likes

My install is kind of old (everything is relative maybe), 2021 I guess.
The default 500 is probably way enough for me as I think I only browse history during each session (as every couple of mornings I wouldn’t remember the name of the command I’m looking for anyway :sweat_smile: and finding it some place else for would be way faster :upside_down_face:).
And as you pointed out, it is probably a good security mesure to not have an history (or at least an unlimited one).
So there’s that, I don’t really care about the size (although some people I know would argue it does matter).

I was just “worrying” about that “bug” with the .bash_history.tmp

I guess my best move will be to erase those files and try to set whatever limit to the config and to see if they come back anytime soon (when the history is full?).

Do you think my ~/.bashrc “needs” any modification? (I assume at the moment it is used to show the welcome screen, print messages about updates, about arch news…and…stuff?)
I didn’t modify it and the .tmp files weren’t there before a couple of months (I guess…)

if there is nothing in bashrc that limits the history then bash will remember the history up to 500. After that bash continues to remember the history but in a tmp file as the bash history is already full.
That is why you see all those bashrc tmp files

So all you have to do is set some limit in bashrc (as all described in the link)

3 Likes

I agree, unless @dalto has anything to add.

No, if it’s from a 3? year old installation then leave it be.

1 Like

I wish I could have marked this tread as solved, but… still random (at least for me) creation of .bash_history-xxxxx.tmp (all empty this time, for the moment at least, before some did contain data) even after I took the steps @fred666 recommended… I rebooted a couple of times since then and all…
I wonder why @dalto was talking about behavior from the editor in the first place… Did he see something before :ghost: :alien: :scream: ?!

1 Like

¯\_ (ツ)_/¯ mmmèèèèhhh… not like it’s a big deal anyway…

Maybe there is somewhere a script that is miss behaving, creating forkbombs and is not able to remove the temporary files anymore. Or a variable/command to use the temp directory fails and it defaults to home directory? How often does this happen? I would suggest to delete those files, open the filemanager and watch this directory on the side. Also open a system monitor tool to watch what processes are running. Now do your daily stuff you are doing, while always having an eye on the filemanager and system monitor. Open your programs, do your thing; basically debug your system.

3 Likes

thanks for the recommendation.

So, I just kind of monitored that…

Well, if I open a terminal, type commands, do stuff, well, when I close it, most of the time (but not each time), one (empty) .tmp file gets created…

if i look at the same time journalctl -f and dmesg -w nothing shows (although that might not be what to look at…), and the “system monitor” (glances, again that might not be what to look at?) shows lots of available memory, no particular process eating CPU resources…

.bash_history gets populated with the last commands…

idk :expressionless:

mine pile up, too. Instead of remedying the cause for said pile up, I just send them all to the trash weekly then delete them. No repercussions.


is the history file supposed to be this “type” of file?

…almost glad I’m not the only one
I guess that will have to be the solution anyway :sweat_smile:

1 Like

Well if anyone has read the article and my comments why still trying to fix something that isn’t a problem if you set the limits you want is bashrc?

Due a change in bashrc this behaviour began and that is because there never is set a limit. Earlier bash didn’t complain about this but does now.

So set the limit and your done, no big deal

I’m sorry, you did not understand.

I DID set the limits like you suggested.

My bad, didn’t notice that, sorry

All i can say that on my EndeavouOS install i don’t get those tmp files anymore since i set those limits

1 Like

I think I will delete all the bash related files, config files and environment variable and recreate those and see what happen from there… I have to read the wiki and bash manual a bit more though :expressionless:
Thanks a lot for your help, much appreciated !

i would recommend to simply replace it with the default one in case you do not changed it, we do not ship a modified .bashrc anymore.

Cheers!

This is my .bashrc btw
guess it was shipped with my EOS install

bash.rc
#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

[[ -f ~/.welcome_screen ]] && . ~/.welcome_screen

_set_my_PS1() {
    PS1='[\u@\h \W]\$ '
    if [ "$(whoami)" = "liveuser" ] ; then
        local iso_version="$(grep ^VERSION= /usr/lib/endeavouros-release 2>/dev/null | cut -d '=' -f 2)"
        if [ -n "$iso_version" ] ; then
            local prefix="eos-"
            local iso_info="$prefix$iso_version"
            PS1="[\u@$iso_info \W]\$ "
        fi
    fi
}
_set_my_PS1
unset -f _set_my_PS1

ShowInstallerIsoInfo() {
    local file=/usr/lib/endeavouros-release
    if [ -r $file ] ; then
        cat $file
    else
        echo "Sorry, installer ISO info is not available." >&2
    fi
}


alias ls='ls --color=auto'
alias ll='ls -lav --ignore=..'   # show long listing of all except ".."
alias l='ls -lav --ignore=.?*'   # show long listing but no hidden dotfiles except "."

[[ "$(whoami)" = "root" ]] && return

[[ -z "$FUNCNEST" ]] && export FUNCNEST=100          # limits recursive functions, see 'man bash'

## Use the up and down arrow keys for finding a command in history
## (you can write some initial letters of the command first).
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'

################################################################################
## Some generally useful functions.
## Consider uncommenting aliases below to start using these functions.


_GeneralCmdCheck() {
    # A helper for functions UpdateArchPackages and UpdateAURPackages.

    echo "$@" >&2
    "$@" || {
        echo "Error: '$*' failed." >&2
        exit 1
    }
}

_CheckInternetConnection() {
    # curl --silent --connect-timeout 8 https://8.8.8.8 >/dev/null
    eos-connection-checker
    local result=$?
    test $result -eq 0 || echo "No internet connection!" >&2
    return $result
}

_CheckArchNews() {
    local conf=/etc/eos-update-notifier.conf

    if [ -z "$CheckArchNewsForYou" ] && [ -r $conf ] ; then
        source $conf
    fi

    if [ "$CheckArchNewsForYou" = "yes" ] ; then
        local news="$(yay -Pw)"
        if [ -n "$news" ] ; then
            echo "Arch news:" >&2
            echo "$news" >&2
            echo "" >&2
            # read -p "Press ENTER to continue (or Ctrl-C to stop): "
        else
            echo "No Arch news." >&2
        fi
    fi
}

UpdateArchPackages() {
    # Updates Arch packages.

    _CheckInternetConnection || return 1

    _CheckArchNews

    #local updates="$(yay -Qu --repo)"
    local updates="$(checkupdates)"
    if [ -n "$updates" ] ; then
        echo "Updates from upstream:" >&2
        echo "$updates" | sed 's|^|    |' >&2
        _GeneralCmdCheck sudo pacman -Syu "$@"
        return 0
    else
        echo "No upstream updates." >&2
        return 1
    fi
}

UpdateAURPackages() {
    # Updates AUR packages.

    _CheckInternetConnection || return 1

    local updates
    if [ -x /usr/bin/yay ] ; then
        updates="$(yay -Qua)"
        if [ -n "$updates" ] ; then
            echo "Updates from AUR:" >&2
            echo "$updates" | sed 's|^|    |' >&2
            _GeneralCmdCheck yay -Syua "$@"
        else
            echo "No AUR updates." >&2
        fi
    else
        echo "Warning: /usr/bin/yay does not exist." >&2
    fi
}

UpdateAllPackages() {
    # Updates all packages in the system.
    # Upstream (i.e. Arch) packages are updated first.
    # If there are Arch updates, you should run
    # this function a second time to update
    # the AUR packages too.

    UpdateArchPackages || UpdateAURPackages
}


_open_files_for_editing() {
    # Open any given document file(s) for editing (or just viewing).
    # Note1: Do not use for executable files!
    # Note2: uses mime bindings, so you may need to use
    #        e.g. a file manager to make some file bindings.

    if [ -x /usr/bin/exo-open ] ; then
        echo "exo-open $*" >&2
        /usr/bin/exo-open "$@" >& /dev/null &
        return
    fi
    if [ -x /usr/bin/xdg-open ] ; then
        for file in "$@" ; do
            echo "xdg-open $file" >&2
            /usr/bin/xdg-open "$file" >& /dev/null &
        done
        return
    fi

    echo "Sorry, none of programs [$progs] is found." >&2
    echo "Tip: install one of packages" >&2
    for prog in $progs ; do
        echo "    $(pacman -Qqo "$prog")" >&2
    done
}

_Pacdiff() {
    local differ pacdiff=/usr/bin/pacdiff

    if [ -n "$(echo q | DIFFPROG=diff $pacdiff)" ] ; then
        for differ in kdiff3 meld diffuse ; do
            if [ -x /usr/bin/$differ ] ; then
                DIFFPROG=$differ su-c_wrapper $pacdiff
                break
            fi
        done
    fi
}

#------------------------------------------------------------

## Aliases for the functions above.
## Uncomment an alias if you want to use it.
##

# alias ef='_open_files_for_editing'     # 'ef' opens given file(s) for editing
# alias pacdiff=_Pacdiff
################################################################################

and

.bash_profile
#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc

thats default one shipped with bash package:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '

bind '"\e[A":history-search-backward'      # history with arrow up key
bind '"\e[B":history-search-forward'       # history with arrow down key

this last two lines are not default but usefull…

bind '"\e[A":history-search-backward'      # history with arrow up key
bind '"\e[B":history-search-forward'       # history with arrow down key
1 Like

I have those lines.

Maybe my .bash was modified by eos-welcome too ?

guess that’s “usefull” too ?