Linux self-study journey-basic commands (whereis and which)

Linux self-study journey-basic commands (whereis and which commands)


Preface

1. In the previous section, we talked about the second help command help, which mainly introduced the function and basic use of help. If you haven't read it yet, please click the link below to watch it: help command

2. In this section we begin to talk about some search commands in Linux


Tip: The following is the content of this article

One, whereis command

whereis can help quickly find the path where the binary file, help page, and source code of a certain command are located.

  • Command name: whereis
  • 命令全称:locate the binary, source, and manual page files for a command
  • Location: /usr/bin/whereis
  • Execution authority: all users
  • Function description: Find the path of a command binary file, help information, and source code
命令格式
whereis [选项] 命令
-b:只显示二进制文件
-m:只显示帮助信息
-s:只显示原始代码文件

Just give two examples:
1. As shown in the figure below, directly after whereis is followed by a command ls, the result can be divided into two parts, the first part is
/usr/bin/ls: it represents the path
behind the path where the binary file of ls is stored The content at the end of .gz: It represents the storage path of the man help file of ls.
Insert picture description here


2. As shown in the figure below, I just want to know where the binary file of ls is stored. Add the -b option to display only the binary file of ls.
Insert picture description here

二、which

which is also the path of the binary file that can display the command

  • Command name: which
  • The full name of the command: shows the full path of (shell) commands.
  • Location: /usr/bin/which
  • Execution authority: all users
  • Function description: List the path of the binary file of the command
命令格式
which 命令

for example:

[root@student ~]# which ls
alias ls='ls --color=auto'
	/usr/bin/ls
[root@student ~]# 

(which后面接一个命令ls,会直接显示ls的二进制文件所在路径以及ls的一个别名,
别名我们没说,就先不理,只要知道which可以显示命令的二进制文件所在路径就行了。)

to sum up

In this section we talked about { whereis: can display the binary file of the command, help information, the path of the source code which: can display the binary file of the command and alias information (if a command has no alias, only the path of the binary file is displayed, not displayed Alias ​​information) }The next section we continue to talk about some search commands



This is Jiehua, see you next time!

Guess you like

Origin blog.csdn.net/qq313088385/article/details/113467458