fish-shell/doc_src/history.txt
Kurtis Rader cbee315b1b fix the history function and man page
The previous commit to add a `--with-timestamp` flag to the `history` command
caused me to notice the history function didn't recognize the new long option.
Neither did it recognize the short options for the builtin command. This
change fixes both of those issues.
2016-06-30 22:01:59 -07:00

47 lines
2.1 KiB
Text

\section history history - Show and manipulate command history
\subsection history-synopsis Synopsis
\fish{synopsis}
history ( -m | --merge )
history ( -s | --save )
history ( -l | --clear )
history ( -s | --search ) [ -t | --with-time ] [ -p "prefix string" | --prefix "prefix string" | -c "search string | --contains "search string" ]
history ( -d | --delete ) [ -t | --with-time ] [ -p "prefix string" | --prefix "prefix string" | -c "search string | --contains "search string" ]
history ( -t | --with-time )
history ( -h | --help )
\endfish
\subsection history-description Description
`history` is used to list, search and delete the history of commands used.
The following options are available:
- `--merge` immediately incorporates history changes from other sessions. Ordinarily `fish` ignores history changes from sessions started after the current one. This command applies those changes immediately.
- `--save` saves all changes in the history file. The shell automatically saves the history file; this option is provided for internal use.
- `--clear` clears the history file. A prompt is displayed before the history is erased.
- `--search` returns history items in keeping with the `--prefix` or `--contains` options. Without either, `--contains` will be assumed.
- `--delete` deletes history items. Without the `--prefix` or `--contains` options, the exact match will be deleted. With either of these options, a prompt will be displayed before any items are deleted.
- `--prefix` searches or deletes items in the history that begin with the specified text string.
- `--contains` searches or deletes items in the history that contain the specified text string.
- `--with-time` prefixes the output of each displayed history entry with the time it was recorded in the format "%Y-%m-%d %H:%M:%S" in your local timezone.
\subsection history-examples Example
\fish
history --clear
# Deletes all history items
history --search --contains "foo"
# Outputs a list of all previous commands containing the string "foo".
history --delete --prefix "foo"
# Interactively deletes the record of previous commands which start with "foo".
\endfish