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