I installed Ubuntu 10.10 yesterday. Then while using the terminal I noticed that once I quit a terminal session its history is gone, although history exists for applications in terminal like-ROOT(CERN) history.
In giving the command
echo $HISTFILESIZE
it shows 2000. I changed that to 10000 when I quit the session and opened a new terminal; it again shows history as 2000 and no command can be accessed through up/down arrow key.
Please help. I am getting frustrated with soooo…. lot of typing in the terrminal.
Best Answer
If no commands can be run using ↑ or ↓ that indicates that your history file is empty or you have no read-permissions. Check that.
Maybe you run the commands as another user. If so do:
and look at the output.
If you change
$HISTFILESIZE
the changes will be overwritten, whenever you invoke an other shell. To prevent that you should change that variable in your.bashrc
. Also you should set the variable$HISTSIZE
to a larger value.Generally usefull tips using histories:
Ctrl+R does a reverse search of your history for you. Alt+. pastes the last argument of the last command into your prompt at cursor position.
Also the bang (
!
) operator will repeat commands for you in terminal (if it's just about saving you some typing. Example:All those histroy related things are stored in the home directory of any user in a file called
.bash_history
. You can look them up by using thehistory
-command. Her is a small tutorial on howto use history.Another very usefull thing is to create a
.inputrc
file in your home directory with the following content:This way you can use the ↑ or ↓ to complete commands you started to type from history. E.g. when you type a rather lenghty command such as
rsync -a -v --human-readable --prune-empty-dirs -e 'ssh -i .ssh/id_rsa' --include="*/" --exclude="snapshot_*" --exclude="restart.*" /scratch/ x@cluster1:/home/x/runs/
and want to run it a second time you can just typersy
and then ↑ an it will complete to the last command that started with rsy. Another press of the uparrow will complete to the second-last and so on. I don't know why this isn't the default.