Difference between revisions of "ShellEnhancement"

From SME Server
Jump to navigationJump to search
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 it file size.
Line 10: Line 9:
  
 
==Expand memory of you .bash_history==
 
==Expand memory of you .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 this on your .bashrc:
 
<pre>
 
<pre>
 
export HISTFILESIZE=2000
 
export HISTFILESIZE=2000

Revision as of 16:54, 20 December 2008

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. 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.

sort -u /root/.bash_history -o /root/.bash_history

Expand memory of you .bash_history

Expand the memory of your .bash_history to 2000 lines adding this on your .bashrc:

export HISTFILESIZE=2000
export HISTSIZE=2000

Easy search using arrows

Create a .inputrc, or edit your /etc/inputrc, with :

"\e[A": history-search-backward
"\e[B": history-search-forward

Next logon you'll be able to search command by start to write them and use up/down arrows.

"\e[1;5A": history-search-backward
"\e[1;5B": history-search-forward

Will allow you to use ctrl+up/down arrows (and your up/down arrows will work as usual).