The note reads as follows:
1, built-in command and external command of the Division
2. Use and difference of help, man, info command
Built-in commands and external commands
There are some tools for viewing help that are treated differently on built-in commands and out-of-the-way commands.
The built-in commands are actually part of the shell program, which contains simple Linux system commands written in the builtins of the bash source, identified by the shell program and run inside the shell, usually when the Linux system is loaded The shell is loaded and resides in system memory. and parsing the internal command shell does not need to create a child process, so it executes faster than an external command. For example: History, CD, Exit and so on.
External commands are part of a utility in a Linux system, because the utility is usually powerful, so it contains a large number of programs that are not loaded into memory with the system when the system is loaded, but instead being transferred into memory when needed. Although it is not included in the shell, its command execution process is controlled by the shell. External commands are installed outside of Bash, usually on/bin,/usr/bin,/sbin,/usr/sbin, and so on. For example: LS, vi and so on.
We can use the type command to differentiate whether the command is built-in or external. For example, the two results are different.
# The result is that the built-in command, as stated above, is builtins in the bash source. def is a shell builtin # The result is an external command, as stated above, the external command is in/usr/bin or/usr/sbin, etc. is/usr/bin/xxx# If you get the result of alias, it indicates the name set by the command alias; is XX--xxx
Help commands
1. Help command
# Help xxx can only be used for internal commands and cannot be used for external commands $help CD DHSAFKDSJFAKJSDGJKASDBKJDSBFASDFDSFDSAGSDGSDGSDGASDGASDGDSAGDSAGDSGDAGSDGDSG (a bunch of help documents) $help LS not with "LS" Match xxxx# xxx--help for external command $ls-- HELPDHSAFKDSJFAKJSDGJKASDBKJDSBFASDFDSFDSAGSDGSDGSDGASDGASDGDSAGDSAGDSGDAGSDGDSG (a bunch of help documents)
2. Man command
$man ls
The resulting content is more detailed than help, and man has no distinction between built-in and external commands , because the man tool is the display of the contents of the System manual page, which is an electronic version of the dictionary, most of which is the interpretation of the command, and some related descriptions. You can also get more information about the program and more features of Linux by looking at the man in the system documentation.
When we try this command we will find that the upper left corner shows "LS (1)", where "ls" denotes the manual name, and "(1)" indicates that the manual is in the first chapter. What is this chapter? There are so many chapters in the Man Handbook.
Chapter number Description
1standard commands (Standard command)
2system calls (System call)
3library functions (library function)
4special devices (device description)
5file formats (file format)
6Games and Toys (games and entertainment)
7miscellaneous (Miscellaneous)
8administrative Commands (Administrator command)
Span style= "font-family:"microsoft yahei"" >9 Other (Linux-specific) documents used to store kernel routines.
After opening the manual we can go up and down through PgUp and PgDn or up and down, you can press Q to exit the current page
3. Info command
$info ls
With more information than man, info comes from the GNU project of the Free Software Foundation and is the GNU hypertext Help system that displays the GNU message more fully. So the information you get is certainly more
Man and info are like two collections, they have an intersection part, but compared with man, the info tool can display more complete GNU tool information. If the man page contains an overview of a tool that is also described in info, then the man page will have the words "please refer to info page for more details".
Source: Laboratory Building
Links: https://www.shiyanlou.com/courses/1
Linux: Help commands, man, info