Linux Learning-which Command __linux

Source: Internet
Author: User
Linux Learning-which command

Which is where path is specified, searches for the location of a system command, and returns the first search result. By using the which command, you can see whether a system command exists, and which location is executing the command.


Common parameters and their functions:

-N: Specifies that the file name length specified must be greater than or equal to the longest file name in all files.

-P: The same as the-n parameter but the path of the file is included here.

-A: The instructions in the path directory can be found more than the first one.

-W: Specifies the width of the field when output.

-V: Display version information


High frequency operation:

Find a common command path

[Atong@liwentong tmp]$ which PWD
/bin/pwd


Specific alias information is listed when you look for an alias command

[Atong@liwentong tmp]$ which LS
Alias ls= ' ls--color=tty '
/bin/ls


The lookup command is not in the normal user's path such as the Ifconfig command

[Atong@liwentong tmp]$ which ifconfig
/usr/bin/which:no ifconfig in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/atong/bin)


Bash built-in command cannot be traced as CD command

[Atong@liwentong tmp]$ which CD
/usr/bin/which:no CD in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:

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.