Hack Forums
How do I change my history size? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Computing (https://hackforums.net/forumdisplay.php?fid=88)
+---- Forum: Linux (https://hackforums.net/forumdisplay.php?fid=85)
+---- Thread: How do I change my history size? (/showthread.php?tid=4704574)



How do I change my history size? - u534D - Feb 25, 2015

How does a guy change his history size? By default there's 1000 lines. I want to go back and review my history for scripting later so I can be more productive. Here's the problem I'm running into. Every tutorial or article I find about this seems to be written by someone who has no idea what they are doing?

What files do I need to edit? Variables to change? stuff to comment out?

From what I could find the file I'm supposed to edit is bash.bashrc. If I make changes to it, it does nothing. There are a few articles that say I'm supposed to edit environment. This is something that really seems like it should be easy to do. 🤝


* - Benign - Feb 26, 2015

Are you working directly from the command line or connecting in with putty over ssh?


See here if on cli http://stackoverflow.com/questions/9457233/unlimited-bash-history

If it's putty it's under the session settings I can't remember off the top of my head but I can look if you need it, I use it daily but I have it set globally now.


Final point, it's .bashrc in your home directory, not bash.bashrc


* - u534D - Feb 26, 2015

It's still clear as mud. When I edit /etc/bash.bashrc it does nothing for me. Is there another file I'm supposed to edit?


* - Benign - Feb 26, 2015

Edit /home/yourusername/.bashrc or /etc/.bashrc

Note the lack of the bash before the . This is not a typo.


* - u534D - Feb 26, 2015

There's nothing like that in my home folder. Is it in /Home/usr/ ? /usr/share/


* - Betty Blue - Feb 26, 2015

(Feb 26, 2015 12:02 PM)u534D Wrote:  There's nothing like that in my home folder. Is it in /Home/usr/ ? /usr/share/
Yes there is
PHP Code

<?php 
ls 
-al | grep .bash 
It is a hidden file.


* - u534D - Feb 26, 2015

(Feb 26, 2015 02:21 PM)Zack de la Rocha Wrote:  Yes there is
PHP Code

<?php 
ls 
-al | grep .bash 
It is a hidden file.

Cool. I found it with:
Code
ls -al | grep .bash

Then I opened with
Code
gedit .bashrc

Am I to understand that changing these two lines will give me unlimitted history?
Change this:
Quote:HISTSIZE=1000
HISTFILESIZE=1000


To this:
Quote:HISTSIZE=
HISTFILESIZE=


Or is there something else I have to do?


* - Betty Blue - Feb 26, 2015

(Feb 26, 2015 05:11 PM)u534D Wrote:  Cool. I found it with:
Code
ls -al | grep .bash

Then I opened with
Code
gedit .bashrc

Am I to understand that changing these two lines will give me unlimitted history?
Change this:

To this:

Or is there something else I have to do?
That should do it, you can either do that or set it to some high number.


* - u534D - Feb 26, 2015

Totally worked!

If I run
Code
echo $HISTSIZE
I get a blank output and that's exactly what I need.


* - Benign - Feb 27, 2015

This may default to a system wide history limit from the global bashrc. Setting it to -1 will force it to be unlimited.

It may be fine now though now and you can ignore the above :)


* - u534D - Feb 28, 2015

Good to know. I always forget about -1.