history
history is the built-in command that prints the command history of that user to the screen. It has no subcommand, field or option.
Command Summary
The lines are listed from oldest to newest; the command that was run last appears at the bottom.
How the History Is Kept
| Feature | Behavior |
|---|---|
| Scope | The history is per user; every user sees only their own commands |
| Persistence | It is kept even if the session closes, and the next session continues with the same history |
| Limit | At most 100 lines are kept; when the limit is exceeded, the oldest lines drop |
| Repetitions | When the same command is written one after another, it appears once in the history |
The following lines are not written to the history: exit, logout and the lines that are interrupted halfway.
Navigating in the History
| Shortcut | Its function |
|---|---|
| ↑ ↓ | Navigates in the history in order |
| Ctrl + R | Starts a search in the history; as it is typed the matching command is shown, and when it is pressed again it moves to an older match |
| → or End | Accepts the suggestion that appears in grey at the end of the line |
During the search the prompt turns into the (reverse-i-search) form; if a match is not found, it writes (failed reverse-i-search).
The grey suggestion
When a command starts to be written, the last command in the history that begins with that text appears in grey in the continuation of the line. It is accepted with → or End; when another key is pressed, it disappears.
Things to Know
- It does not require authorization. Every user who has a session can see their own history.
- Passwords can fall into the history. The password fields that are asked secretly are not written to the history, but the secrets written openly on the command line (such as a client secret key or an LDAP service account password) stay in the history.
- There is no delete command. The history cannot be cleared from the command line; as the records reach the 100-line limit, they drop starting from the oldest.
- Interrupted commands do not count. A line that is left halfway with Ctrl + C is not written to the history.
