1

Is there a script or configuration or other tool that can show you inline most common examples of usage of given command for ex. user type:

  • tar and it shows tar xzvf my-archive.tar.gz
  • ls and it shows ls -la
  • xrandr and it shows xrandr --output Virtual1 --mode 1280x800

Minimal description can be included like extract the contents of archive change resolution of screen. Is there other method to get examples while typing in bash?

  • The man command sometimes includes examples, but if you use info Command instead of man Command you may get more information, including examples, though I wouldn't assume that what you regard as common examples will be covered. You should also look at this link to see if the examples there are useful to you. – AFH Mar 9 '18 at 15:52
  • Nice source of examples. What I have in mind are examples appear interactively while typing. – lluke Mar 9 '18 at 16:09
  • I've never heard of this as a requirement and I can't quite imagine how it might work within bash. You may have to write your own: perhaps you can extend the complete and compspec functions (see man bash). – AFH Mar 9 '18 at 16:31
1

You can install the following utility on your terminal.

howdoi

This is like having google printing direct results on your terminal.

| improve this answer | |
0

If you want a builtin answer, you might like Ctrl+r, which is "reverse search". Basically, once pressed, it searches through your command history for the most recent usage of whatever you're typing. This won't help, of course, for commands that you've never used before, but it can be quite useful.

(On the same note, I highly recommend learning these shortcuts.)

(Also, you can just create aliases for command-flag combos that you use a lot, such as alias ll='ls -lA'.)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.