Tip: set the Terminal to store only unique commands in the history
When you enter commands in the Terminal, they are saved in a history that you can scroll through by pressing the up and down arrows. This tip prevents the same item from being saved to the history over and over again.
When you enter commands in the Terminal, they are saved in a history that you can scroll through by pressing the up and down arrows. This is convenient because you can quickly access previously entered commands for repetitive tasks, or to access previously used syntax for a command. While this is useful, if you have entered the same command several times you will have to scroll through the same command in the terminal in order to get to a unique command you entered. This default behavior can be changed, which may be convenient for people who access the terminal frequently.
To alter the behavior of the terminal so it will only store unique commands and not keep a series of the same command in its history, you will need to add an argument to the shell's profile. A Unix shell is an environment in which terminal applications and commands are run. There are a variety of them, with Bash or "Bourne Again Shell" being the one that is used by default for users in OS X. In order to customize the Bash history to not record duplicate commands, follow this procedure:
Launch the Terminal
Enter the following command to edit the bash history (I use "pico" by habit, but it's really "nano"):
When the editor opens, press the down arrow to get to the last line, and add the following to the file:
When finished, press control-O to save the document (confirm overwriting), then press control-X to close it.
Quit and relaunch the Terminal.
When this is done, you should now be able to enter the same command multiple times without all the same entries being saved to the command history, making command navigation much easier in some cases.
For more information about how to customize and use Bash (or most other Unix commands), open the terminal and enter "man bash," or see the online manual page.