Announcement

Collapse
No announcement yet.

Change HISTSIZE and HISTFILESIZE

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [CONFIGURATION] Change HISTSIZE and HISTFILESIZE

    I want to change the number of commands that Bash saves to 25. From a web search it looks like I should set HISTFILESIZE=25 and leave HISTSIZE alone. But I can't find my bashrc file to edit these variables. It doesn't seem to be in my home folder nor in /etc. There is a skel folder with bashrc in it in the /etc folder. The only other bash file I see in /etc is bash.bashrc, which has different contents than skel/bashrc and no line with either HISTFILESIZE or HISTSIZE. Did I somehow erase the bashrc file that's supposed to be in my home folder? There's a history being stored somewhere because I can recall previous commands.

    #2
    Your bashrc is in your home but it's hidden. One way to edit it, ALT-F2 to open krunner, then type:

    kate ~/.bashrc

    HISTSIZE is a "live" list while you're working in bash, and HISTFILESIZE is the number of lines that are saved to disk.

    Please Read Me

    Comment


      #3
      Originally posted by oshunluvr View Post
      Your bashrc is in your home but it's hidden.
      And if it's not there as ".bashrc" (you don't have to have one), just create it.

      Note that login shells don't have to run .bashrc, they run the first one of ~/.bash_profile, ~/.bash_login, and ~/.profile that is found; however the default ~/.profile (default for debian, I think) sources .bashrc if it exists. I mention this for completeness because your ~/.profile might have been deleted or the bit running .bashrc might have been removed.

      I've got stuff in my .bashrc that I've had for a long time, some of it going back to when I used the Korn shell. (I use HISTFILESIZE=420, and HISTSIZE=2000).
      Regards, John Little

      Comment


        #4
        So I copied the contents of /etc/skel/.bashrc to an open kate document ~/.bashrc and saved it with the HISTSIZE=25 and HISTFILESIZE=25. This seems to work fine.

        I am a bit worried because besides there being no .bashrc in my home directory there is also no .bash_login or .profile folder in my home directory. Some how I must have wiped these out doing some other operation. Are there backups somewhere I should copy to my home folder? Is there a list somewhere of what the contents of my home folder should be? How big a problem is this?

        Comment


          #5
          Originally posted by lcharles View Post
          I am a bit worried because besides there being no .bashrc in my home directory there is also no .bash_login or .profile
          Just checking you know about "hidden" files... dolphin, and the ls command, won't show files beginning with a ".", unless you tell them to (Alt-. in dolphin, -a for ls). dolphin also hides files whose names are listed in a .hidden file.

          Assuming they're not hidden, I expect you deleted them somehow.

          Are there backups somewhere I should copy to my home folder?
          (At the risk of sounding patronising) There surely should be. But unless you've installed something that does it, or snapshots automatically, or made a backup yourself, no. Catching the hidden files in a manual backup, and not stuff you don't want, like .cache/mozilla, needs care.

          Is there a list somewhere of what the contents of my home folder should be?
          When a new user is created, files are copied from /etc/skel I think. There's not many and there's only a few hundred lines of text. I'd only copy them if you don't have them.

          How big a problem is this?
          Not at all, I think. But do make backups of your data, while I hide my blushes about the spotty nature of my backups.
          Regards, John Little

          Comment


            #6
            You could also end up with no home folder or skel files if you created a user with "useradd" and left out the "-m" switch, then go and manually create the user folder. There's only three files in skel normally; .bash_logout, .bashrc, and .profile.

            Please Read Me

            Comment


              #7
              Looking at the hidden files in /home and comparing it to an earlier installation version of Kubuntu on another partition things seem mostly OK. I do backups of data once in a while but not the entire /home directory.

              I copied /etc/skel/.profile and .bash_logout to /home. Things seem to be working alright.

              Comment

              Working...
              X