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.

Get Mac OS X Tiger in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.