Any command/tool to show example of a command

Solution 1:

Quite a long time, and I found some solutions:

tldr

  • need: npm
  • url: https://github.com/tldr-pages/tldr
  • command: tldr tar

PS: tldr support many clients (check readme on above repo). Especially the go client can work offline and provide all platform binaries : https://github.com/leighmcculloch/tldr/

enter image description here

cheat

  • need: python
  • url: https://github.com/chrisallenlane/cheat
  • command: cheat tar

eg

  • need: python
  • url: https://github.com/srsudar/eg
  • command: eg tar

enter image description here

Solution 2:

Unfortunately,no.

Documentation is up to the developers, so it is their responsibility to include examples into man pages. Sometimes they do, sometimes they do not. For instance , find command has very lovely and extensive EXAMPLES section in its man page.

Tools for providing examples would be handy, but since there are millions of commands/programs for Ubuntu and Linux in general, developing such tool would be a considerable effort, on the level of Sisyphus. Simple approach is just search online for usage examples of whatever program you are trying to run. Books are also very handy resource. Many of books on Linux, Unix, shell scripting, etc - they provide lots of examples and more importantly usage context for those commands.

If you believe that the manual page for a particular tool should contain (more) examples, please file a bug report with its maintainers or developers on Launchpad or “upstream” or, better yet, submit a patch that adds these examples.