Other than viewing the history, is there a way to filter my history?
Say I want to search for a command that started with "ssh"?
|
Other than viewing the history, is there a way to filter my history? Say I want to search for a command that started with "ssh"? |
||||
|
|
|
Press Ctrl+R and type |
||||
|
|
|
If you just want to search your history, you can just use |
|||
|
|
Pressing Ctrl+R will start "reverse-i-search" mode, typing "ssh" would search your history for commands which contain "ssh". |
||||
|
|
|
I do a slight variation of the above, works well for me (if you're referring to your bash history In my home folder I create a file named
Inside goes this
Then typing however much of a previous command I wish & using the page up/page dn buttons searchs the history, always starting with page up |
|||
|
|
I found the following function somewhere on the Internet and have used it to great effect. Put this in your
Now re-load your shell:
It will show you a list of matching commands from your history. To run a command, type
I like this approach better than Ctrl+R because it allows much more flexible searches, and I can see multiple results at once. |
|||
|
|
|
Here's another method using classic commands (more likely to work across distros). Command history is stored in the file
Don't forget the |
|||
|
|
|
If you use shell in Emacs ( |
|||
|
|