Linux DevOps tip: how to learn about any command fast without leaving the Linux command line.
In this article, I will show you three quick ways to learn about any Linux command.
Let’s say you want to know what the cp command does in Ubuntu 22.04.
You have at least three options to discover that without leaving the Linux command line: help, info, and man.
The built-in help command in the bash shell only lists some of the shell’s built-in commands and keywords. It's an internal documentation system for that shell.
As you can see here, bash shell cannot find any help topics related to the cp command. That’s because the help command is used with shell-built-in commands in bash. Built-in commands are those that are integrated directly into the shell itself, rather than being external programs.
cp is not part of bash; it’s a separate executable, located in /usr/bin/cp in Ubuntu 22.04.
This is why I prefer to use the following option if I want to use help:
$ cp --help
In Ubuntu 22.04, --help supports both build-in and external commands.
Recommended by LinkedIn
$ info cp
The info command displays documentation in Info format.
The “Info” program is a stand-alone program, part of the Texinfo distribution, which is used to view Info files on a text terminal. Texinfo is also used to generate HTML and printable (PDF/PS) versions.
$ man cp
man is the system’s manual pager. Each page argument given to man is normally the name of a program, utility, or function. That’s the traditional Unix documentation system.
It’s a matter of taste which command to use. In this article, I wanted to show that you don’t have to use Google to learn Linux commands. You don’t have to leave the command line at all for that.
Technology wrangler, opinion haver. Words expressed here are my own.
1yThere are some additional differences between man and info: man is practically always available, while info sometimes isn't included with the base install (I'm running Debian Stable and info was not installed by default). Most applications have a man page, but much fewer applications have an info page. However, you can just run 'info' with no arguments to view a hypertext-formatted table of contents to browse info pages installed on your system. Info pages are also written to be more like a user guide than a terse manual page. All of these options give slightly different information, so it's good to check all three if you need to.