Knowing your history

Shells provide an interesting feature that allows you to find out the history of all commands you have executed previously in a shell. It often happens that we forget what command was typed on the previous day to perform a task. We may or may not be able to recall the exact syntax, but it is very convenient that we can refer to the history saved by the shell.

Shell variables controlling the history

There are shell variables that can be altered to change what and how much history a user can see. These shell variables are mentioned in the following table:

Name

Value

HISTFILE

Name of file in which by default history will be saved

HISTFILESIZE

Number of commands to be kept in history file

HISTSIZE

Number of history to be ...

Get Linux Shell Scripting Essentials 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.