Linux which command belongs to the search command, it will be used when you want to find a file, the following with the small series to understand the specific command under Linux Usage, interested friends may wish to find out.
effect which command is specified in the PATH variable path, searches the position of a system command, and returns a search result first. In other words, using the which command, you can see if a system command exists and which command is executed.
1. Command format:
which executable file name
2. Command Function:
Which command searches for the location of a system command in the path specified by the PATH variable and returns the first search result.
3. Command Parameters:
-n Specifies the length of the file name. The specified length must be greater than or equal to the longest file name in all files.
-p Same as the -n parameter, but here is the path to the file.
-w Specifies the width of the field at the time of output.
-V Display version information
4. Use case:
Instance 1: Find file, display command path
Command:
which lsmod
Output:
[root @localhost ~]# which pwd
/bin/pwd
[root@localhost ~]# which adduser
/usr/sbin/adduser
[root@localhost ~]#
Description:
which is to search for executable files based on the directory in the PATH variable configured by the user! Therefore, the commands found by different PATH configuration contents are of course different!
Example 2: Use which to find out which
command:
which which
output:
[root@localhost ~ ]# which which
alias which=‘alias |
/usr/bin/which --tty-only --read-alias --show-dot --show-tilde’
/usr/bin/which
[root@localhost ~ ]#
Description:
There will be two which, one of which is alias. This is the so-called "command alias", which means that input which will be equal to the following sequence of commands!
Example 3: This command cd find
command:
which cd
Output:
Description: < Br>
cd This commonly used command can't be found! why? This is because cd is a built-in bash command! But which default is to find the directory specified in the PATH, so of course not found!
The above is the usage of the which command under Linux. The search command under Linux is not limited to this command. There are other commands that can be used to find the file location. The usage of different commands is slightly different.
Among the many commands in Unix, some commands are often used, and some commands ar
Under the CentOS system, if only single-user mode is used, there will be hidden dan
Kali Linux is a Debian-based Linux distribution. It is a new penetration testing system. How do you
There are a lot of software that can convert text files into PDF files. In Linux, you can convert te
How Linux can view the number of 80 port connections through the netstat command
How Linux prohibits specific ip address access
How to import files from a Docker container to the host
What should I do if the syntax of the Linux Vi editing code is not colored?
Ubuntu Chromium how to install Flash
Linux system vim how to install vundle component
How to solve the Linux account expiration?
Fedora 19 download and install NixNote steps
Summary of zypper command usage in SUSE Linux system
Summary of tar commands in Linux system
What are the methods for uninstalling QQ input method in Windows 10 system?
How to improve the battery life of Win10 equipment? Win10 battery life lifting method diagram
LOL participates in the battle night must have permanent skin activity website share
Lumia professional shooting or will become the default camera application for Win10 devices
In Windows XP, you can also have Flip 3D effects
Text multi-line text merge is easy to solve WPS table conversion clever help
How to restore the Win7 system application default open mode?