Help cmd in linux

How can I get help on terminal commands?

I’d also like to mention tldr.sh, which is an effort to simplify and present man pages in a better way.

@Nodon’tshownmyrealname Would you write an answer about tldr ? You could also mention cheat and maybe cheat.sh.

9 Answers 9

What is a man page?

A man page (short for manual page) is the traditional form of software documentation on a Unix-like OS like Ubuntu. For the vast majority of commands and programs there’s a man page which lists its options and explains its usage.

How can I find and view man pages?

Offline in a terminal

Man pages are automatically installed on your system together with the commands they describe. To view and search man pages there’s the command man :

displays the man page of mv while

searches names and short descriptions of all installed man pages for the string mv . POSIX Extended Regular Expressions are allowed and it’s a search, so this will also find e.g. git-mv and semver , if you want to search exactly mv use ^mv$ instead.

See What is the difference between `man` and `man (#)`? to read about man page sections. For more information read man ‘s man page. 😉

How can I influence how a man page is displayed?

The default program to display man pages is less . This so-called pager provides a helpful search function, just enter / followed by the search term, e.g.

and press Enter . This will mark every finding and scroll to the first one. Press N to go to the next finding and ⇧ Shift + N to go to the previous one (see How can I search within a manpage?). For a list of commands press H , to exit less press Q .

Beside less there are other pagers available: pg , most and w3m just to list three. I recommend most : It comes with a very useful coloring of key words making a man page much easier to read and navigate, see for yourself:

most screenshot displaying mv's manpage

To view a man page in a different than your default pager use the -P option, e.g.:

If you want to change the default pager manpages are displayed with you have two options:

    change the default pager solely of man

sudo update-alternatives --config pager 

Fans can even (ab)use vim as the MANPAGER , see this article written by muru.

Man pages are displayed in the font specified in your terminal emulator settings. If you work with the terminal regularly you might want to change this font; I can only recommend Hack – a typeface designed for source code, see the screenshot above for its beauty.

Offline via GUI

A nice and easy way to display man pages with a simple GUI is the preinstalled yelp program. To start a man page with yelp execute yelp man:PROGRAM or gnome-help man:PROGRAM , e.g.:

Читайте также:  Bittorrent для linux mint

You can also view man pages with your preferred browser, see How do I make man pages open in a web browser?, e.g. for man mv in firefox :

Last but not least you can convert man pages to PDF and view them with your preferred PDF viewer, see: Is there a way to print info/man pages to PDF?

Online

http://manpages.ubuntu.com

You can view the man pages of programs available via the repositories of every currently supported Ubuntu version with the shorthand URL manpg.es/PROGRAM , e.g. http://manpg.es/mv. This opens mv ‘s man page for the latest Ubuntu release, you can choose a different release in the top bar. To search for man pages you can use e.g. http://manpages.ubuntu.com/cgi-bin/search.py?q=mv.

As explained above man can only display man pages of software installed on the system. To view man pages from http://manpages.ubuntu.com using a terminal pager there’s dman available in the bikeshed package.

Other sources

When you read documentation from other online sources it’s a good idea to keep an eye on the program version. Most programs have a —version option that displays the version of the program in question, e.g.

$ mv --version mv (GNU coreutils) 8.25 

There are a lot of websites which dedicated themselves to make man pages easily available, I’m just going to present the two I like the most:

  • man7.org comes with useful syntax highlighting, but it features only the last released version of the program
  • manpag.es hosts man pages of Ubuntu releases long gone EOL

Источник

help Command in Linux with examples

If you are new to LINUX operating system and having trouble dealing with the command-line utilities provided by LINUX then you really need to know first of all about the help command which as its name says help you to learn about any built-in command.
help command as told before just displays information about shell built-in commands. Here’s the syntax for it:

// syntax for help command $help [-dms] [pattern . ] 

The pattern specified in the syntax above refers to the command about which you would like to know and if it is matched with any shell built-in command then help give details about it and if it is not matched then help prints the list of help topics for your convenience. And the d, m and s here are options that you can use with the help command.

To make you understand more easily about what help command does let’s try help command for finding out about help itself.

// using help $help help help: help [-dms] [pattern. ] Display information about builtin commands. Displays brief summaries of builtin commands. If PATTERN IS specified, gives detailed help on all commands matching PATTERN, otherwise the list of help topics is printed. Options: -d output short description for each topic -m display usage in pseudo-manpage format -s output only a short usage synopsis for each topic matching PATTERN Arguments: PATTERN Pattern specifying a help topic Exit Status: Returns success unless PATTERN is not found or an invalid option is given. /* so that's what help command does telling everything about the command and helping you out */

Options for help command

  • -d option : It is used when you just want to get an overview about any shell built-in command i.e it only gives short description.
  • -m option : It displays usage in pseudo-manpage format.
  • -s option : It just displays only a short usage synopsis for each topic matching.
Читайте также:  Kali linux network scanning cookbook

Using help with options

    Using -d : This option just lets you know about what a command does without giving you details about its options and other stuff.

// using help with -d $help -d help help - Display information about builtin commands.
// using help with -s $help -s help help: help [-dms] [pattern . ]
// using help with -m $help -m help NAME help - Display information about builtin commands. SYNOPSIS help [-dms] [pattern . ] DESCRIPTION Display information about builtin commands. Displays brief summaries of builtin commands. If PATTERN IS specified, gives detailed help on all commands matching PATTERN, otherwise the list of help topics is printed. Options: -d output short description for each topic -m display usage in pseudo-manpage format -s output only a short usage synopsis for each topic matching PATTERN Arguments: PATTERN Pattern specifying a help topic Exit Status: Returns success unless PATTERN is not found or an invalid option is given. SEE ALSO bash(1) IMPLEMENTATION GNU bash,version 4.3.11(1)-release (i686-pc-linux-gnu) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later

So that’s all about help command.

Источник

8 Ways To Get Help On The Linux Shell

8 ways to get help on the Linux shell

8 ways to get help on the Linux shell

Whenever we use new software or a new operating system, the interface and the environment we are used to change as well. Sometimes the new environment is user-friendly and we don’t find it difficult to deal with. But sometimes the new environment is so complex and foreign to us that we are completely clueless. In this situation, we need someone to guide us or some kind of help from the new environment to lead us to our goals. For this purpose, almost every software and operating system has some kind of built-in help to assist naive and inexperienced users. The Ubuntu terminal or command-line interface also provides us with numerous ways to get help.

How to get Help while Working on the Shell

The ways to get help from Ubuntu terminal or Command-line are listed below:

Use the command options –h or –help

If you don’t know how to use a command i.e. you don’t know about its parameters and return type etc, then you can make use of –h or –help command.

How to use –h or –help?

Launch the terminal by pressing Ctrl+ Alt+ T or just click on the terminal icon in the taskbar. Simply type your command whose usage you to know in the terminal with –h or –help after a space and press enter. And you’ll get the complete usage of that command as shown below.

Use tab completion on the Shell

If you do not know the exact name of a command, then you can make use of tab completion.

How to use tab completion?

Launch the terminal by pressing Ctrl+ Alt+ T or just click on the terminal icon in the task bar. Just type the command name that you know in the terminal and then press tab twice as shown below.

Читайте также:  Linux ssh port knocking

Tab completion on Linux Shell

Unknown Commands

If you want to use a command, but you do not know whether it’s installed on Ubuntu or not or if it does exist, you do not know the package containing it, even then you can use that command.

How to use an unknown command?

Launch the terminal by pressing Ctrl+ Alt+ T or just click on the terminal icon in the taskbar. Just type the command in the terminal anyway and press enter. Your terminal will tell you whether it’s installed or not or if it is installed then in which package it exists. This is shown below.

Unknown command on Linux

The help command

This is the command which is used for listing all possible commands that are pre-installed in Ubuntu.

How to use help comm

Launch the terminal by pressing Ctrl+ Alt+ T or just click on the terminal icon in the task bar. Simply type help in the terminal and press enter key. This is shown below.

Linux Help Command

The man command or man pages

Man is used when you want to get a detailed manual of a command.

How to use man command?

Launch the terminal by pressing Ctrl+ Alt+ T or just click on the terminal icon in the task bar. Just write man in the terminal and after a space, write the name of the command whose manual you want and press enter. This command works as shown below.

Linux man command

to get extensive help on the Linux bash shell.

The info command

Some commands do not have their manuals or written or they are either incomplete. To get help with those commands, we use info.

How to use info?

Launch the terminal by pressing Ctrl+ Alt+ T or just click on the terminal icon in the task bar. Just type info in the terminal and with a space, type the name of the command whose manual does not exist and press enter. This is shown below.

The apropos command

This command is used along with another command to search for all the man pages in which the latter command exists.

How to use apropos?

Launch the terminal by pressing Ctrl+ Alt+ T or just click on the terminal icon in the task bar. Just type apropos in the terminal and after a space, type the name of the command whose appropriate man pages you want to find and press enter. This is shown below.

Linux apropos command

The whatis command

This command is used with another command just to show a one-liner usage of the latter command from its manual. It’s a quick way of knowing the usage of a command without going through the whole manual.

How to use whatis?

Launch the terminal by pressing Ctrl+ Alt+ T or just click on the terminal icon in the taskbar. Just type whatis in the terminal and after a space, type the name of the command whose one liner description you want, and then press enter.

Linux Whatis command

By using any of the ways that are listed above, you can get appropriate help from the Ubuntu terminal or Command-line whenever you find yourself in trouble while using it.

About This Site

Vitux.com aims to become a Linux compendium with lots of unique and up to date tutorials.

Latest Tutorials

Источник

Оцените статью
Adblock
detector