fish-shell/doc_src/history.txt

45 lines
1.8 KiB
Text
Raw Normal View History

\section history history - Show and manipulate command history
2012-06-05 04:24:42 +00:00
\subsection history-synopsis Synopsis
2014-08-01 12:25:41 +00:00
\fish{synopsis}
2014-08-26 18:19:24 +00:00
history ( --merge | --save | --clear )
history ( --search | --delete ) [ --prefix "prefix string" | --contains "search string" ]
\endfish
2012-06-05 04:24:42 +00:00
\subsection history-description Description
`history` is used to list, search and delete the history of commands used.
2012-06-05 04:24:42 +00:00
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.
- `--delete` deletes history items.
- `--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.
2012-06-05 04:24:42 +00:00
If `--search` is specified without `--contains` or `--prefix`, `--contains` will be assumed.
If `--delete` is specified without `--contains` or `--prefix`, only a history item which exactly matches the parameter will be erased. No prompt will be given. If `--delete` is specified with either of these parameters, an interactive prompt will be displayed before any items are deleted.
2012-06-05 04:24:42 +00:00
\subsection history-examples Example
2012-06-05 04:24:42 +00:00
\fish
history --clear
# Deletes all history items
2012-06-05 04:24:42 +00:00
history --search --contains "foo"
# Outputs a list of all previous commands containing the string "foo".
2012-06-05 04:24:42 +00:00
history --delete --prefix "foo"
# Interactively deletes the record of previous commands which start with "foo".
\endfish