- No.
- 29
- Date
- Learning goal
- Terminal Start, lesson 9
- Level
- 2 of 3
Command of the day No. 29: Ctrl-R
Purpose: Searches your command history backwards while you type.
Syntax: Ctrl-R, then type part of a command
Example:
grep -n WARN logs/app.log
3:WARN disk 85% full
7:WARN slow response
wc -l logs/app.log
8 logs/app.log
(reverse-i-search)`grep': grep -n WARN logs/app.log Output from the simulator, as on a real Linux.
Options:
Try it in the terminal Share image
Fills in the command. Nothing runs until you press Enter. Press Enter so the command is in your history. Then press Ctrl-R and type grep: the line comes back. Enter runs it again.