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.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityI 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.
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.