Javatpoint Logo
Javatpoint Logo

Shell History Commands

While interacting with terminal, you'll be typing some commands very often and sometimes typing with variations on those commands. Sometimes it can be very irrritating as well as a little bit time consuming.

Luckily, shell provides some commands to repeat the history of the commands used. Shell makes it easy for us to repeat the commands we have used. Once you'll learn how to use those commands effectively, you can save a lot of time in typing the commands.


Shell History Search Command

CommandFunction
!! (bang bang)Repeats last typed command.
!(one or two letters from starting of command) (bang)To repeat other commands other than last typed command.
historyShows a list of older commands.
!nRepeats the command at line number n.
Ctrl -r (three or four characters from starting of command)Repeats the mentioned command.
$HISTSIZEDetermines number of commnds stored in the history.
$HISTFILEDisplays location of file that contain histoty.
$HISTFILESIZETo set numbet of commands stored in history file

Keys In History Command:

  • UP arrow key : Will scroll you backwards in history.
  • ctrl + p : Will scroll you backwards in history.
  • DOWN arrow key : Will scroll you downwards in history.
  • ctrl + n : Will scroll you downwards in history.
  • ctrl + r : Will take you to the command including the specified character.
  • ctrl + g : Escape from history searching mode.
Next TopicLinux History Size




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA