2

I have been trying to free up space on my full SD card.

I've been wondering if one can clear the history in bash when one presses the up arrow. I have been unable to find a command that would enable one to do this.

  • 2
    As Steve explains, you are wasting your time contemplating how to throw a snowball at a line of tanks. That cache will amount to less than 1/1000th of 1% of the space on the card. – goldilocks Dec 6 '15 at 15:20
6

That is the bash history not a cache. It is stored in the .bash_history file in your home directory. By default it is limited to a set number of lines (1000) and the size of the file (2000). So even if you remove it you would gain very little. You can check the size of the file by doing an ls -lah in your home directory. I have a custom script that stores every command I enter and in more than 16 months the file is less than 2 MBs). The pertinent settings are HISTSIZE and HISTFILESIZE. These are set in your .bashrc file (again located in your home directory). To find out more about HISTSIZE and HISTFILESIZE and the differences between them check this question. This functionality is immensely helpful and should not be removed. I have used Linux since the mid 1990's and still use this feature daily.

If you are that constrained for disk space I would suggest that the problem lies elsewhere. To find what is utilizing the disk space you can use the df and du commands. You can learn more about these commands by typing man du or man df (tip: check out the -h option for both commands). This will load the man (manual aka help) page for the commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.