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 pwd pwd: /usr/share/man/man1/pwd.1.gz |
?
1 2 |
[email protected]:~$ whereis pwd pwd: /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]:~ # |