1.2-linux command Help to get detailed

Source: Internet
Author: User
Tags documentation perl regular expression syslog

External command: There is an executable program located in a directory of the file system:

Which,whereis

The path to the Shell program search executable file is defined in the PATH environment variable:

# echo $PATH

Note: From left to right



Internal command:

#help COMMAND

External command:

(1) # COMMAND--help

# command-h

(2) User manual (manual)

# Man COMMAND

(3) Information page

# info COMMAND

(4) Help documentation for the program itself

Readme

INSTALL

ChangeLog

(5) Official program document

Official site: Documentation

(6) Official documents of the release version

(7) Google



Internal commands help get the way:

# Help COMMAND

Hash command:

The path result of the shell's search for external commands is cached into the KV (Key-value) store

[[email protected] ~]# hash

Hits command

1/sbin/service

1/bin/cat

2/usr/bin/elinks

1/bin/vi

Hits: Cache Hit

When the command is found in the cache, this value is +1


[email protected] ~]# ls #第一次使用ls命令

Anaconda-ks.cfg Install.log Install.log.syslog

[[email protected] ~]# hash

Hits command

1/sbin/service

1/bin/cat

2/usr/bin/elinks

1/bin/vi

1/bin/ls

[Email protected] ~]# mv/bin/ls /usr/bin/ls #将ls命令移动到/usr/bin/ls

[email protected] ~]# ls #再次输入ls命令提示如下:

-bash:/bin/ls: No file or directory

[Email protected] ~]# echo $PATH

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[[email protected] ~]# hash

Hits command

1/sbin/service

1/bin/cat

2/usr/bin/elinks

1/bin/mv

1/bin/vi

2/bin/ls #在缓存当中找而不是在PATH当中找

[[Email protected] ~]# type hash

Hash is a shell builtin #hash是一个内部命令

[[email protected] ~]# help hash

Hash:hash [-LR] [-P pathname] [-DT] [name ...]

Remember or display program locations.

Determine and remember the full pathname of each command NAME. If

No arguments is given, information on remembered commands is displayed.

Options:

-D Forget the remembered location of each NAME

-l display in a format that is reused as input

-P Pathname Use pathname are the full pathname of NAME

- R Forget all remembered locations

-T print the remembered location of each NAME, preceding

Each location with the corresponding NAME if multiple

NAMEs is given

Arguments:

name each name are searched for in $PATH and added to the list

of remembered commands.

Exit Status:

Returns success unless NAME is not found or a invalid option is given.

[Email protected] ~]# hash-r #清除缓存当中所有记录

[[email protected] ~]# ls

Anaconda-ks.cfg Install.log Install.log.syslog

[[email protected] ~]# hash

Hits command

1/usr/bin/ls



History command:

What is the role? What are the relevant environment variables? Useful options?

Manage Command history:

When you log in to the shell, the commands that are recorded in the command history file are read: ~/.bash_history

After logging into the shell, the newly executed command is only recorded in the cache. These commands are "appended" to the command history file when the user exits

History

-A: Append the newly executed command history list to the history file in this session

-D: Delete the command specified in history

-C: Empty command history

Quick action:

!n: Invoking the nth command in history

!string: Call the last command in history that starts with a string

!! : Call the previous command



External commands help get the way:

(1) COMMAND--help

[[Email protected] bin]# type grep

grep is/bin/grep

[[email protected] bin]# grep--help

Usage: grep [options] ... PATTERN [FILE] ...

Find the PATTERN in each FILE or standard input.

The default PATTERN is a basic regular expression (abbreviated to BRE).

For example: Grep-i ' Hello World ' menu.h main.c

Regular expression Selection and interpretation:

-E,--extended-regexp PATTERN is an extensible regular expression (abbreviated as ERE)

-F,--fixed-strings PATTERN is a set of fixed-length strings separated by a break character.

-G,--basic-regexp PATTERN is a basic regular expression (abbreviated as BRE)

-P,--perl-regexp PATTERN is a Perl regular expression

-E,--regexp=pattern using PATTERN for matching operations

(2) Man COMMAND

Manual page:/usr/share/man

Man1...man8

Man1: User Commands

Man2: System call

MAN3: library Call

MAN4: Equipment files and special files

MAN5: Configuration file format

MAN6: Game-related

MAN7: Miscellaneous

MAN8: Commands for managing classes


Note: Some keywords exist in more than one section of the Help manual, to view the manuals in the specified chapters: Man n COMMAND


Configuration file for man command:/etc/man.config

Manpath:/path/to/somewhere: Indicates the new manual file search location

# man-m/path/to/somewhere Command: Searches the command command's hand pages to the specified location and displays


The paragraph description in the Help manual:

Name: program names and brief description

Sysnopsis: Commands use brief help

DESCRIPTION: A detailed description of the function

Options: Option

EXAMPLES: Using the example

AUTHOR: Author

REPORTING BUGS:

See ALSO:


Sysnopsis:

[]: Optional content

<>: Optional content

A|b: Two Choose one

... : The same content can appear multiple times


How to operate the man command: (call less command)

SPACE,CTRL+V,CTRL+F,CTRL+F: Flip the screen to the end of the file

B,CTRL+B: Flip the screen to the file header

D,ctrl+d: Turn half screen at the end of the file

U,ctrl+u: Turn half screen to file header

RETURN or ^n or E or ^e or J or ^j: Turn 1 lines at the end of the file

Y or ^y or ^p or K or ^k: Turn 1 lines to the file header

Q: Exit

G: Back to File header

G: Turn to the tail of the file


Text Search:

/keyword:

Searches for the trailing end of the file from the current location with the string specified as keyword: case insensitive to characters

N: Next

N: Previous

? KEYWORD:

Contrary to/keyword usage


Exercise: Date command

What is the day of the week?

Set the current system time?

Show today's date, shape: 08/15/15?

Displays the current time, in the form of: 16:01:21?


(3) Info

Info COMMAND


(4) Help documentation for the program itself

/usr/share/doc/command-version

(5) Official program document

Official website

(6) Official documents of the release version

Http://www.redhat.com/docs

(7) Google

OpenStack Filetype:pdf #指定搜索的openstack文档为PDF格式

OpenStack site:openstack.com #指定在openstack. com site for Search

(8) SlideShare

https://www.slideshare.net/


1.2-linux command Help to get detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.