O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

history

Synopsis

                  history [options]

Display the list of history events. (History syntax is discussed earlier in Section 8.6.)

Options

-c

Clear history list.

-h

Print history list without event numbers.

-r

Print in reverse order; show oldest commands last.

n

Display only the last n history commands, instead of the number set by the history shell variable.

-L file

Load series of pushd and popd commands from file in order to re-create a saved stack.

-M file

Merge the current directory stack and the stack saved in file. Save both, sorted by time, in file as a series of pushd and popd commands.

-S file

Print to file a series of pushd and popd commands that can be invoked to replicate the stack.

-T

Print with timestamp.

Example

To save and execute the last five commands:

                  history -h 5 > do_it
                  source do_it

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required