Yesterday’s recommendation:Learn a Linux command every day (50): Date
The which command is used to find and display the absolute path information of the specified command, and find the path by the environment variable path. You can also see whether a system command exists by using the which command.
which [options] [--] programname [...]
-a # Print all matching pathnames for each matching file name -V # Print version information
Which exit status
0 # All file names were found and all files are executable one # One or more file names cannot be found or are not executable two # The specified option is invalid
Displays the full path of the command
[[email protected] ~]# which which alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' /usr/bin/alias /usr/bin/which [[email protected] ~]# which ls alias ls='ls --color=auto' /usr/bin/ls [[email protected] ~]# which pwd /usr/bin/pwd [[email protected] ~]# which rz /usr/bin/rz [[email protected] ~]# which ifconfig /usr/sbin/ifconfig