O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

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]

                        history
                      [lines]

Print a numbered command history, denoting modified commands with *. Include commands from previous sessions. You may specify how many lines of history to print.

Options

-a [ file]

bash maintains a file called .bash_history in the user's home directory, a record of previous sessions' commands. Ask bash to append the current session's commands to .bash_history or to file.

-c

Clear history list: remove all previously entered commands from the list remembered by the shell.

-d offset

Delete the history entry at the specified offset from the beginning of the history list.

-n [ file ]

Append to the history list those lines in .bash_history or in file that haven't yet been included.

-p args

Perform history substitution on the specified arguments, and display the result on standard output. The results aren't stored in the history list. Each argument must be quoted to disable normal history expansion.

-r [ file ]

Use .bash_history or file as the history list, instead of the working history list.

-s args

Remove the last command in the history list, and then add the specified arguments to the list as a single entry (but don't execute the entry).

-w [ file ]

Overwrite .bash_history or file with the working history list.

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