Register to get access to free programming courses with interactive exercises

History and man-pages Basics of Bash

Video may be blocked due to browser extensions. In the article you will find a solution to this problem.

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 history
  • history to view history
  • !N to 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 Doc will repeat the previous command and pipe it with grep Doc
  • man to open man-page (help page) (e.g. man wc to open man-page for wc command)
    • opens inside a pager, so same navigation with j, k etc. works.

Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

Bookmate
Health Samurai
Dualboot
ABBYY

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.