Linux Find Files

Source: Internet
Author: User
Tags bz2

which can find the location of the executable file

?
1 2 [email protected]:~$ which ping/bin/ping

Whereis

Whereis-m where can I find the help document for the command?

?
1 2 3 4 [email protected]:~$ whereis -m ls ls: /usr/share/man/man1/ls.1.gz [email protected]:~$ whereis -m pwdpwd: /usr/share/man/man1/pwd.1.gz

?
1 2 [email protected]:~$ whereis pwdpwd: /bin/pwd /usr/include/pwd.h /usr/share/man/man1/pwd.1.gz

There are three output information
1. The directory where the command itself is located
2. The directory where the source files are located
3. The directory where the Help document is located

Locate is faster than find based on the local computer database (computer disk information). Locate generally updates the database at night, but can also update itself manually

?
1 [email protected]:~# sudo updatedb
?
1 2 3 4 5 6 7 8 [email protected]:~/test# ls 1.txt  2.txt  aa.tar.gz  ab.tar.bz2  ac.tar  ac.tar.bz2  ac.tar.gz [email protected]:~/test# locate aa.tar.gz /root/test/aa.tar.gz [email protected]:~/test# cd /tmp [email protected]:/tmp# locate aa.tar.gz /root/test/aa.tar.gz[email protected]:/tmp#

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 创建一个新文件,用locate试试~ [email protected]:~/test# touch aobama [email protected]:~/test# ed aobama 0 a 我是新创建的文件, 看下locate命令能找到我么~ . w 63 q [email protected]:~/test# locate aobama [email protected]:~/test# 结果找不到~

?
1 2 3) 4 5 更新数据库后看下: @IdeaPad:~/test# sudo updatedb [email protected]:~/test# locate aobama /root/test/aobama[email protected]:~/test#

Find command full scan, similar to Windows search; slower

Find can be found based on file name

?
1 2 3 4 5 6 [email protected]:~# find ./ -name ‘te*‘ ./test [email protected]:~# find ./ -name ‘1*‘ ./test/1.txt ./1.txt[email protected]:~#

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.