Linux command (+): which command

Source: Internet
Author: User

which command

functional description

the which command is used to find and display the absolute path of a given command, and the environment variable path holds the directory that needs to be traversed when the find command is saved. The which directive looks for eligible files in the directory where the environment variable $path is set. That is, with the which command, you can see whether a system command exists, and the command that executes exactly which location. The which command applies only to executable programs, not to built-in commands and command aliases. Use the following:

which (option) (parameter)

Command parameters

Options Meaning
-N Specifies the length of the file name, which must be greater than or equal to the longest file name in all files
-P Same as the-n parameter, but here the < filename length > contains the path to the file
-W Specify the width of the field at the output
-V Display version Information

Example

Find command Path

[Email protected] ~]# cat/etc/redhat-release #系统版本为Centos 6.5

CentOS Release 6.5 (Final)

[Email protected] ~]# which chown #找出chown命令路径

/bin/chown

[email protected] ~]# which which #查找自己的路径

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

/usr/bin/which

[[email protected] ~]# which CD #查找内置命令cd, the range of path is listed

/usr/bin/which:no CD in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

[[email protected] ~]# which CD #下面显示是Centos 7, and 6 versions different

/usr/bin/cd


This article is from the "Zhao Dongwei blog" blog, make sure to keep this source http://zhaodongwei.blog.51cto.com/4233742/1871432

Linux command (+): which command

Related Article

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.