Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to query the full path of running files in Linux

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to query the full path of running files in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

In linux, some places need to use the absolute path, for some commands, such as java, mysql, etc., need to use the path where the running file is located, introduce a command to query this path.

Which

You can query the path of the running file through which, as follows:

Detailed explanation of command

Take mysql as an example, the command is as follows:

[work (zhaoweinan) @ tjtxvm-144-80 soft] $which mysql/opt/soft/percona-mysql55/bin/mysql

The command outputs the path where the running file mysql is located

When the file is not available, the output is as follows:

[work (zhaoweinan) @ tjtxvm-144-80 soft] $which baidu/usr/bin/which: no baidu in (/ opt/soft/jdk/jdk1.6.0_45/bin:/opt/soft/jdk/jdk1.6.0_45/jre/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/soft/percona-mysql55/bin/:/opt/soft/percona-mysql55/bin/:/home/) Work/bin) [work (zhaoweinan) @ tjtxvm-144-80 soft] $which orcale/usr/bin/which: no orcale in (/ opt/soft/jdk/jdk1.6.0_45/bin:/opt/soft/jdk/jdk1.6.0_45/jre/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/soft/percona-mysql55/bin/:/opt/soft/percona-mysql55/bin/:/home/work/bin)

Will output the path with the running file

Whereis

Whereis will output the directory where the files are installed, as follows:

Detailed explanation of command

Take mysql as an example, the command is as follows:

[work (zhaoweinan) @ tjtxvm-144-80 soft] $whereis mysqlmysql: / usr/lib64/mysql / usr/share/mysql

When the file does not exist, the file is output: empty string

[work (zhaoweinan) @ tjtxvm-144-80 soft] $whereis baidubaidu:

Find

You can also use the find search command to find

The find command will not be detailed. Give me a chestnut:

[work (zhaoweinan) @ tjtxvm-144-80 soft] $find / usr/share/-name mysql/usr/share/mysql

Which order will be introduced to you here, welcome to communicate, point out some mistakes in the article, let me deepen my understanding, I hope you do not have bug, thank you!

This is the end of this article on "how to query the full path of running files in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report