Linux Basics Help documentation---Common commands [reprint]

Source: Internet
Author: User
Tags aliases builtin

Linux Basics Help Document View-2014.2.11

---common commands

First man: Related commands Whatis

1, man manual find format

Input? Keys, looking forward, such as-H, will search for rows containing "-H"

-Input/Key, backward lookup, such as/-k, will search backwards for "-K" rows

Press N or N (next) to view the previous next related match.

2, where the man handbook is stored

You can view the location of manpage by Manpath command

3, man manual page entry

1 User Instruction 2 System 3 Program Library 4 device 5 file system

6 Games 7 Miscellaneous 8 system Instruction 9 kernel instructions

The commonly used items are: 1,5,8

4, generally with man when you view a command's help document, you can view the command's entry in the man Help document by Whatis, a command may have multiple man manual page entries (note: If you use Whatis, the Linux computer will boot for 70 minutes , then you can use it yourself, if the Linux computer just started, then you need to execute the makewhatis command to compile, otherwise you cannot use the Whatis command)

[Email protected] ~]# Whatis RM

RM (1p)-Remove directory entries

RM (1)-Remove files or directories

[Email protected] ~]# whatis passwd

passwd (1)-Update user ' s authentication tokens

passwd (5)-Password file

passwd (RPM)-the passwd utility for setting/changing passwords using PAM

passwd [sslpasswd] (1SSL)-Compute password hashes

When querying RM or passwd commands with man, you can enter:

Man 5 passwd//At the entrance to the file system to query the passwd help document

Man 1 passwd//At the entrance for user instructions to query passwd's help document

Man 1/1p RM



Second: Help: Related Commands Type,which

1, first explain the internal commands and external commands

Simply put, the command that has a storage location in a Linux system is an external command;

There is no storage location for internal commands, which can be understood as internal commands embedded in the Linux shell, so it is not visible.

2, the Help document for the external command is in the format: command--help

such as: passwd--help

The help document for the internal command is in the form of the Assist-command

such as: Help CD

3, type to determine whether the internal command or internal command

Such as:

[[Email protected] ~]# type help //view the internal and external types of the help command

Help is a shell builtin//can see help as internal command

[[Email protected] ~]# type passwd //view passwd This command is present in the Linux system

passwd IS/USR/BIN/PASSWD//Can see the storage location of the passwd, and therefore exists as an external command

[[email protected] ~]# type cd

CD is a shell builtin

Then passwd is an external command, then the CD is an internal command

4. Use the which command to find executable files (external commands, scripts)

-because the which command explanation was too long, so the

4-1, which searchable range is determined by the environment variable path, typically, the administrator and the normal user's path variable is different, can be logged in as root user, normal user test log in after the Echo $PATH view.

[Email protected] ~]# Su-root

[[email protected] ~]# su-test//Switch to test user

[[email protected] ~]$ echo $PATH//View the test user's environment variables

/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/test/bin

[[Email protected] ~]$ exit

Logout

[[email protected] ~]# echo $PATH//View the root user's environment variables

/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[Email protected] ~]#

4-2, use which to view the execution program location of the mkdir and CP commands:

[[email protected] ~]# which mkdir//mkdir command store location

/bin/mkdir

[[email protected] ~]# which CP//CP command store location

Alias cp= ' Cp-i '

/bin/cp

[Email protected] ~]#

As can be seen from the above results, the output of which includes command aliases. This is because Linux is set up to add alias searches for user-friendly use by which aliases.

4-3, remove the alias below to see the results of the which CP command

[[email protected] ~]# alias which//view which alias is actually equivalent to the following Green Line of command combination

Alias Which= 'alias |/usr/bin/which--tty-only--read-alias--show-dot--show-tilde'

[[email protected] ~]# /usr/bin/which mkdir//Find first target only

/bin/mkdir

[Email protected] ~]# /usr/bin/which CP

/bin/cp

[Email protected] ~]#

4-4, which parameter-a

The path to the which query is $path, so when the query is in the same directory as the first command, it is displayed directly, so if the command is also present in the later directory, it will not be displayed, so you need to use the-a parameter.

[[email protected] ~]#which-a mkdir//Find all targets

/bin/mkdir

/usr/bin/mkdir

4-5, because the internal command is built into the/bin/bash interpreter, and there is no independent executable file exists, so try to use which to search is not found. For example, using which to find a CD, help, and other internal commands will be prompted to find the results

[[email protected] ~]# which CD//view the location where the internal command CD exists

/usr/bin/which:no CD in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin :/usr/bin:/root/bin)//Can be seen, is not present

[Email protected] ~]# which help

/usr/bin/which:no Help in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/ Sbin:/usr/bin:/root/bin)

[Email protected] ~]#



Note: General use the help command to view internal commands!!!

This is the most basic Linux help command, although simple, but the usage is often confused, originally which this command intends to get Whereis, which, Whatis, locate command a piece of said, and afraid to be fascinated by themselves, Whatis and which is now engaged!

This article is from the "Forest blog" blog, provenance http://murongqingqqq.blog.51cto.com/2902694/1358244

Linux Basics Help Document---Common commands [reprint]

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.