One Order a Day - Order Help

One Order a Day - Order Help


How to learn a bash command systematically:

Requirements, understand the format of commands, options, help manuals, cases, exercises, extensions.

What effect do you want to achieve? Do you have such commands, the format and use of commands, what other options do you have, the complete help manual in the system, what are the commonly used options and cases, and the extended use of commands?


5w1h method: what,why,when,where,who,how,


1. Help documentation for the program itself: / usr/share/doc/cmd-version

2. Official Documents for Distribution: http://www.redhat.com/docs

3.Google Hack Search

4.slideshare slides: http://www.slideshare.net/


Typecmd // View command type, whether it belongs to bash internal or external commands, and shows the path

cmd --version or cmd -V // / View the version of the command tool

whatis // Display man help page and simple description

which // Display File Path

whereis // Find file binary, source, man help file path

hash // External Command Cache

help cmd or cmd --help // internal commands to help queries

info // Multi-page Display Command Help

man // Major Command Help Manual, Recommended Use


type

Is the type of display command internal or external?

Usage: type [-afptP] name [name ...]
-a Display all attributes, including alias Alias, internal commands builtin Or external commands and list absolute paths
-f Display whether the file type is internal or external, and show the path
-P Capitalization P,Absolute path to display commands
-t Display the type of command, internal builtin,alias alias,external file,Keyword retention keyword
[Execution of orders]#type -a ls
ls is aliased to `ls -p --color=auto'
ls is /usr/bin/ls
[Execution of orders]#type ll
ll is aliased to `ls -al --color=auto'
[Execution of orders]#type -a cd
cd is a shell builtin
cd is /usr/bin/cd
[Execution of orders]#type -a python
python is /usr/bin/python
[Execution of orders]#type -a cd ls pwd
cd is a shell builtin
cd is /usr/bin/cd
ls is aliased to `ls -p --color=auto'
ls is /usr/bin/ls
pwd is a shell builtin
pwd is /usr/bin/pwd
[Execution of orders]#type whatis
whatis is hashed (/usr/bin/whatis)
[Execution of orders]#type {
{ is a shell keyword
[Execution of orders]#type [
[ is a shell builtin
[Execution of orders]#type apachectl
apachectl is /app/apache25/bin/apachectl

View the version of a command or software

[Execution of orders]#ls --version
ls (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Richard M. Stallman and David MacKenzie.
[Execution of orders]#python -V
Python 2.7.5

whatis

man Help Page and Function Description for Displaying Commands

Usage: whatis [OPTION...] KEYWORD...
-r regular expression regex
[Execution of orders]#whatis ls
ls (1)               - list directory contents
ls (1p)              - list directory contents
[Execution of orders]#whatis ll
ll: nothing appropriate.
[Execution of orders]#whatis cd
cd (1)               - bash built-in commands, see bash(1)
cd (1p)              - change the working directory
[Execution of orders]#whatis python
python (1)           - an interpreted, interactive, object-oriented programming language
[Execution of orders]#whatis -r pwd
lckpwdf (3)          - get shadow password file entry
pwd (1)              - print name of current/working directory
pwd (1p)             - return working directory name
pwd.h (0p)           - password structure
pwdx (1)             - report current working directory of a process
ulckpwdf (3)         - get shadow password file entry
unix_chkpwd (8)      - Helper binary that verifies the password of the current user

which

The absolute path of the display command is searched according to the directory set by PATH. Different users have different PATH, and the contents of the files they search are different.

Usage: /usr/bin/which [options] [--] COMMAND [...]
[Execution of orders]#which -a ls
alias ls='ls -p --color=auto'
        /usr/bin/ls
[Execution of orders]#which -a ll
alias ll='ls -al --color=auto'
        /usr/bin/ls
[Execution of orders]#which -a cd
/usr/bin/cd
[Execution of orders]#which -a python
/usr/bin/python
[Execution of orders]#which apachectl
/app/apache25/bin/apachectl

whereis

Find the binary program, source code, man manual and other related file paths for the specified command

Usage: whereis [options] file
-b Search only binary files
-m Search only man manual
-s Search source code
[Execution of orders]#whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
[Execution of orders]#whereis ll
ll:
[Execution of orders]#whereis cd
cd: /usr/bin/cd /usr/share/man/man1/cd.1.gz /usr/share/man/man1p/cd.1p.gz
[Execution of orders]#whereis python
python: /usr/bin/python /usr/bin/python2.7 /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz
[Execution of orders]#whereis kernel
kernel: /usr/lib/kernel /etc/kernel
[Execution of orders]#whereis apachectl
apachectl: /app/apache25/bin/apachectl
Internal Order Help
[Execution of orders]#help pwd
pwd: pwd [-LP]
    Print the name of the current working directory.
    Options:
      -L        print the value of $PWD if it names the current working
        directory
      -P        print the physical directory, without any symbolic links
 
    By default, `pwd' behaves as if `-L' were specified.   
    Exit Status:
    Returns 0 unless an invalid option is given or the current directory
    cannot be read.

//External command help
[Execution of orders]#whatis --help
Usage: whatis [OPTION...] KEYWORD...
  -d, --debug                emit debugging messages
  -v, --verbose              print verbose warning messages
  -r, --regex                interpret each keyword as a regex
  -w, --wildcard             the keyword(s) contain wildcards
  -l, --long                 do not trim output to terminal width
  -C, --config-file=FILE     use this user configuration file
  -L, --locale=LOCALE        define the locale for this search
  -m, --systems=SYSTEM       use manual pages from other systems
  -M, --manpath=PATH         set search path for manual pages to PATH
  -s, --sections=LIST, --section=LIST
                             search only these sections (colon-separated)
  -?, --help                 give this help list
      --usage                give a short usage message
  -V, --version              print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
Report bugs to cjwatson@debian.org.

man Help Document

Man Storage Address: / usr/share/man

Configuration file for man command: c68: /etc/man.conf | c73: /etc/man_db.conf

man Chapter Classification: 1. User Command 2. System Call 3.C Library Call 4. Device File and Special File 5. Configuration File Format 6. Game 7. Miscellaneous 8. Management Command 9.Linux Kernel API

whatis passwd

man 1 passwd

man 5 passwd

man's display is implemented using less command, and so is the operation.

Downward flip: space, ^ V,^f, ^ F

Turn up the screen: b, ^ B

Turn down half screen: d, ^ D

Turn up half screen: u, ^ U

Turn up a row: Enter, ^ N, e, ^ E, j, ^ J

Turn down one line: y, ^ Y, ^ P, k, ^ K

Exit: q


Jump to line n:

Back to the beginning: 1G

Back to the end:G

Search down, case-insensitive: / keyword next n; last N

Search up, case-insensitive:? keyword next n; last N


The man cmd command helps export to files and retains the original format

man ls | col -b > ls.txt

Go to the manual page of the search command at the specified location and display: man-M/PATH CMD

#man -aw -M /usr/share/man/ passwd
/usr/share/man/man1/passwd.1.gz
/usr/share/man/man1/sslpasswd.1ssl.gz
/usr/share/man/man5/passwd.5.gz
#man -aw -M /usr/local/share/man/ passwd
//Manual page entries without passwd // By default, only one layer of directory matches will be searched, and directory queries will not be recursive
#man -aw -M /usr/local/share/man/zh_CN/ passwd
/usr/local/share/man/zh_CN/man5/passwd.5
 
man -k password  //List all man pages with matching keywords, using whatis database
man -f passwd  //Equivalent to whatis
man -w [chapter]keyword  //Print man help file path
man -w 5 passwd

Other Help Documents: / usr/share/doc

Symbol Description: []: Optional Content <>: Required Content a|b: Two Choices...: The same Content can appear many times


Keywords: Python shell Google Programming

Added by TitanKing on Sat, 22 Jun 2019 23:13:14 +0300