.. highlight:: console .. role:: bash(code) :language: bash :class: highlight Command history --------------- The command line looks quite primitive but has several features which allow you to work very efficiently. One of the most useful is the :dfn:`command history`. - Run some commands from the last session, like :bash:`ls`, :bash:`cd` or :bash:`find`, then use the up and down arrows to avoid re-typing. - Go back in the command history and press :kbd:`Ctrl-o`. What happens? If you have to repeat sequences of commands, this can be very handy! .. TODO ACTIVATE THIS %% Try pressing \kbd{Ctrl-r} and typing a few consecutive characters from a co mmand %% you've uased recently: what happens? Try pressing \kbd{Ctrl-r} again a few times. %% \footnote{\kbd{Ctrl-s} does the same thing, but going forwards. It tends to not %% work by default, though: you have to tweak your shell configuration using \inp{stty -ixon}} %% Try typing \inp{!}, followed by the first few letters of a recent command. What does :command:`history` do? :: $ man history will tell you more than you'll ever need to use. What's in the file :file:`~/.bash_history`? You can re-write history if you want.