Line 1: |
Line 1: |
| == Sort & Remove Duplicates == | | == Sort & Remove Duplicates == |
− | This will sort and remove duplicate commands from your .bash_history file in the /root directory, as well as reducing it file size. | + | This will sort and remove duplicate commands from your .bash_history file in the /root directory, as well as reducing the file size. |
| After you execute the command below, you should edit the file and remove any commands or lines that have errors in them so they aren't | | After you execute the command below, you should edit the file and remove any commands or lines that have errors in them so they aren't |
| executed accidentally. | | executed accidentally. |
| | | |
| <pre> | | <pre> |
− | sort -u /root/.bash_history -o /root/.bash_history | + | sort -u /root/.bash_history -o /root/.bash_history | uniq |
| </pre> | | </pre> |
| | | |
− | ==Expand memory of your .bash_history== | + | == Expand memory of your .bash_history == |
− | Expand the memory of your .bash_history to 2000 lines adding this on your .bashrc: | + | Expand the memory of your .bash_history to 2000 lines adding these lines to your .bashrc: |
| <pre> | | <pre> |
| export HISTFILESIZE=2000 | | export HISTFILESIZE=2000 |
Line 15: |
Line 15: |
| </pre> | | </pre> |
| | | |
− | ==Add Date/time to each line in your .bash_history== | + | == Add Date/time to each line in your .bash_history == |
− | Add Date/time to each line in your history adding this on your .bashrc: | + | Add Date/time to each line in your history adding this line to your .bashrc: |
| <pre> | | <pre> |
| export HISTTIMEFORMAT='%F %T ' | | export HISTTIMEFORMAT='%F %T ' |
Line 25: |
Line 25: |
| Create a .inputrc, or edit your /etc/inputrc, with : | | Create a .inputrc, or edit your /etc/inputrc, with : |
| | | |
− | <pre>"\e[A": history-search-backward | + | <pre> |
| + | "\e[A": history-search-backward |
| "\e[B": history-search-forward | | "\e[B": history-search-forward |
| </pre> | | </pre> |
Line 31: |
Line 32: |
| Next logon you'll be able to search command by start to write them and use up/down arrows. | | Next logon you'll be able to search command by start to write them and use up/down arrows. |
| | | |
− | <pre>"\e[1;5A": history-search-backward | + | <pre> |
| + | "\e[1;5A": history-search-backward |
| "\e[1;5B": history-search-forward | | "\e[1;5B": history-search-forward |
| </pre> | | </pre> |