17
11
With CTRL + R you can search in previous commands (in the terminal of Ubuntu). However, it always seems to display the last occurrence of the search term. Is there any way to browse through all results?
17
11
With CTRL + R you can search in previous commands (in the terminal of Ubuntu). However, it always seems to display the last occurrence of the search term. Is there any way to browse through all results?
34
After you type the few characters to search, you can press CTRL+R again to browse through the history that matches what you typed.
It will be limited to the history size though.
9
You just need to press CTRL-R
again.
2
If you just want to see all matching history lines at once, try fc -ln | grep
.
mress:10077 Z$ fc -ln -100 | grep \^cd
cd /Volumes/Development/android-sdk-mac_x86
cd ~/Downloads/MagicTrackpad.pkg
cd Resources
cd English.lproj
cd ../..
cd MagicTrackpadMultiTouchUpdate1.0.pkg
cd ..
cd
(-100
means "the last 100 commands"; the default is 20, or you can specify a range.)
1
For step on the search you have to CTRL+R
again.
But if you want a list of the command you could use
history | grep 'command to search'
AWESOME! that's exactly what I was looking for! – alfasin – 2012-10-22T00:52:28.543
1For controlling history size, one can note that
HISTFILESIZE
controls the size of the history file (~/.bash_history
), butHISTSIZE
controls the size of the specific terminal history, and it is the latter that decides how far backCtrl+R
can look. I noted this on a machine where I had enlarged the former variable, but not the latter. Both are originally set to500
, but if one wants more reverse searchable history saved, both variables need to be updated. – Daniel Andersson – 2013-10-27T20:34:10.937