Important notes
You can also press Ctrl+r and start typing a command you're looking for. You'll get an autocomplete of your past commands. Keep entering symbols and you'll get closer and closer to the thing you're looking for.
Press Ctrl+r to go to the previous occurence of the matching line
You can "tag" lines with # to find it easier later. E.g.:
ls -la | grep doc | sort -r | wc #report
and then
Ctrl+r #report
You'll quickly come back to the original line. # creates a comment, and everything after # is ignored, but stays in history.
Lesson notes
↑and↓to go to previous/next line in historyhistoryto view history!Nto repeat a line from history, where N is a number (e.g.!32)!!to repeat the previous command- can also be used with other commands, e.g.
!! | grep Docwill repeat the previous command and pipe it withgrep Doc
- can also be used with other commands, e.g.
manto open man-page (help page) (e.g.man wcto open man-page forwccommand)- opens inside a pager, so same navigation with
j,ketc. works.
- opens inside a pager, so same navigation with