Portal Home > Knowledgebase > Articles Database > History count


History count




Posted by cascoing, 11-18-2008, 05:05 PM
History count Is it possible to change the history counts ? Just see, when i type history command on my machine, i get around 1000 last typed commands. Is it possible to change that count ?

Posted by jphilipson, 11-18-2008, 05:20 PM
You can use the HISTSIZE command I know for bash shell... i.e. HISTSIZE=100 (or whatever value you want) and HISTFILESIZE to change the size of the actual history file. __________________I perform System Administration

Posted by cascoing, 11-18-2008, 05:22 PM
root@server# HISTSIZE bash: HISTSIZE: command not found root@server# histize bash: histize: command not found My OS is SUSE-10.

Posted by XH-manojR, 11-18-2008, 05:35 PM
echo $HISTSIZE Check if the variable is set? and what the current value is. or change/add it on the file ~/.bash_profile __________________ Manoj R For Custom Quotes on any Hosting Needs.

Posted by cascoing, 11-18-2008, 05:39 PM
root@server # cat ~/.bash_profile HISTSIZE=100 Is this right ? root@server# echo $HISTSIZE 1000 But, My history command shows 1051 commands now. 1044 histize 1045 cat /etc/issue 1046 echo $HISTSIZE 1047 vi ~/.bash_profile 1048 echo $HISTSIZE 1049 vi ~/.bash_profile 1050 cat ~/.bash_profile 1051 history

Posted by XH-manojR, 11-18-2008, 05:42 PM
thats the number of commands you have entered so far . echo $HISTSIZE , shows u the value of commands that are stored in the file. i.e 1000 for you. __________________ Manoj R For Custom Quotes on any Hosting Needs.

Posted by cascoing, 11-18-2008, 05:49 PM
Quote: Originally Posted by manojr thats the number of commands you have entered so far . echo $HISTSIZE , shows u the value of commands that are stored in the file. i.e 1000 for you. Yes, 1000 for my server, i accept. But, how come it shows 1051 ? As it has been set for 1000, it show only the last 1000 commands rt ?

Posted by cascoing, 11-19-2008, 11:14 AM
Today i see more commands, around 1100. Please help me.

Posted by dexxtreme, 11-19-2008, 03:05 PM
If you have reached the limit of your history size (i.e., HISTSIZE is set to 1000 and you have 1000 commands in your history), then the older history entries will start rolling off of the top. (E.g., if the latest command in your history is 1012, then the earliest command in your history would be 13.) If you don't log out, then your history commands will continue to roll over. The history count does not get "reset" until after you log out. To truly see how many entries are in your history, type "history | wc -l". Also, HISTSIZE only deals with commands during your current active session. You may want to set the HISTFILESIZE variable as well, just in case. Otherwise it might not save enough entries in the history file and may truncate the older commands.

Posted by cascoing, 11-19-2008, 04:05 PM
Thanks for the detailed explanations.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
clustered.net down? (Views: 632)