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

What is the difference between whereis and which in Linux

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What is the difference between whereis and which in Linux? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

Linux Command the difference between the search command whereis and which

One whereis

1. Grammar

Whereis command name

Search for the path where the command is located and the location of the help document

Options:

-b: find only executable files

-m: find only help files

2. Actual combat

[root@localhost ~] # whereis lsls:/usr/bin/ls / usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz [root@localhost ~] # whoamiroot [root@localhost ~] # whatiswhatis what? [root@localhost ~] # whatis lsls (1)-list directory contentsls (1p)-list directory contents [root@localhost ~] # whereis-b lsls:/usr/bin/ls [root@localhost ~] # whereis-m lsls:/usr/share/ Man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz

Two which

1. Grammar

Which command name

Search for the path and alias where the command is located

2. Actual combat

[root@localhost] # which lsalias ls='ls-- color=auto'/usr/bin/ls [root@localhost ~] # which pwd/usr/bin/pwd [root@localhost ~] # whereis cdcd:/usr/bin/cd / usr/share/man/man1/cd.1.gz/usr/share/man/man1p/cd.1p.gz [root@localhost ~] # which cd/usr/bin/cd

Three PATH environment variables

Defines the path to the system search command

[root@localhost] # echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin this is the answer to the question about what is the difference between whereis and which in Linux. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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