After you type a command line, that entire command line is saved in your shell’s history list. The list is stored in a history file, from which any command can be recalled to run again. After it is recalled, you can modify the command line, as described earlier.
To view the contents of your history list, use the history command. You can either type the command without options or follow it with a number to list that number of the most recent commands. Here’s an example:
$ history 8
382 date
383 ls /usr/bin
384 man sort
A number precedes each command line in the list. There are several ways to run a command immediately from this list, including:
· Run Command Number (!n) — Replace the n with the number of the command line, and the command line indicated is run.
· Run Previous Command (!!) — Runs the previous command line.
· Run Command Containing String (!?string?) — Runs the most recent command that contains a particular string of characters.
To view the contents of your history list, use the history command. You can either type the command without options or follow it with a number to list that number of the most recent commands. Here’s an example:
$ history 8
382 date
383 ls /usr/bin
384 man sort
A number precedes each command line in the list. There are several ways to run a command immediately from this list, including:
· Run Command Number (!n) — Replace the n with the number of the command line, and the command line indicated is run.
· Run Previous Command (!!) — Runs the previous command line.
· Run Command Containing String (!?string?) — Runs the most recent command that contains a particular string of characters.
No comments:
Post a Comment