Recall a previous command

Lesson 5 of 30 · Working with Linux

Interactive Bash can remember commands. history displays available entries, usually with numbers; the contents, storage, and numbering depend on configuration. History may persist after the terminal closes and may contain sensitive text. Do not put passwords, tokens, or other secrets directly in commands.

At an empty prompt, Up typically recalls an earlier command. Down moves toward newer entries. You can edit the recalled text before pressing Enter. Check its paths and arguments: a relative path can refer to a different file when the working directory has changed.

clear usually clears the visible display; Ctrl+L commonly redraws it. Neither is a reliable way to erase history or terminal scrollback. Key bindings and history settings can vary. If the practice session was closed, use cd ~/linux-practice (or the new name you chose) to return, then use pwd to confirm the location.