Difference between revisions of "Hdi2u S12"

From wiki
Jump to: navigation, search
(Created page with "= Command history = * This is another very handy tool for saving typing * Previous commands you have used are stored in your "history". * You use the up and down arrow keys t...")
 
(No difference)

Latest revision as of 22:33, 19 April 2017

Command history

  • This is another very handy tool for saving typing
  • Previous commands you have used are stored in your "history".
  • You use the up and down arrow keys to travel through all the command you can used previously.
  • The command itself, historywill return a list of the last 15 commands run.
  • Going back sequentially can be a bit tedious, ctrl+r will accept hints from you and try to find the past comman that most ressembles your hints.

Exercise

  • Try
history -3
ctrl+r kir
  • Are you seeing what you are expecting?

Keybindings for using the history file

These commands are run blind. They refer to the command you last ran, which most of the time is visible in the line above.

  • :<RET>: save command in history, do not execute.
  • !$<RET>: the final argument of the last command
  • !!<RET>: the entire last command
  • !:1-$<RET>: everthing except the first word of the last command
  • !$<RET>: the final argument of the last command
  • ^then^now<RET>: replace the first occurence of then in last command with now
  • !!:gs/then/now<RET>: replace the ALL occurences of "then" in last command with "now"