Linux shells maintain a record of the commands issued by the user. You can view the list of commands that you have entered before by using the history command. This is a neat shell feature because it enables you to repeat some complex commands you have entered eariler. By default, the last 500 commands are shown.
You can also execute a command by its number in the history. For example, in the picture above, you can see that the “man -k shell” command is at number 17. To execute that command again, we would type “!17” (without quotes):
The shell enables you to retrieves the previous entry from the command history by pressing the Uparrow on your keyboard. You can also press Ctrl+r to search your command history. For example, to search the history for commands that include “dd” we would press Ctrl+r and then type dd:
To find the next command in history that includes “dd” press Ctrl+r again.
Post a Comment