网站建设租房网模块关于网站建设需要了解什么东西
- 作者: 五速梦信息网
- 时间: 2026年03月21日 07:40
当前位置: 首页 > news >正文
网站建设租房网模块,关于网站建设需要了解什么东西,广告投放运营方式,我想开个网站文章目录1.which命令1.1 whereis命令1.2 locate命令1.3 搜索文件命令总结2.find命令2.1 find之exec用法2.2 管道符之xargs用法3 Linux常用命令4.命令执行优先级1.which命令
查找命令文件存放目录
搜索范围由环境变量PATH决定#xff08;echo \(PATH) which命令格式#xff1…
文章目录1.which命令1.1 whereis命令1.2 locate命令1.3 搜索文件命令总结2.find命令2.1 find之exec用法2.2 管道符之xargs用法3 Linux常用命令4.命令执行优先级1.which命令
查找命令文件存放目录
搜索范围由环境变量PATH决定echo \)PATH) which命令格式which 命令|程序名 //默认当找到第一个目标后不再继续查找 或者 which -a 命令|程序名 //在所有搜索路径中查找 注意
使用which查找内部命令时将找不到对应的程序;
which搜索命令查不到路径的两种情况
1.该命令是内部命令
2.该命令是外部命令但该外部命令没有放置到PATH环境变量所指定的路径中
which查询外部命令没有放置到PATH环境变量路径中的解决方法
1.用绝对路径或相对路径将外部命令手动添加到系统中默认的路径中/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:
2.先进入系统目录将外部命令复制到指定目录中
[rootclr ~]# which ls #查看ls命令在系统中的位置
alias lsls –colorauto/usr/bin/ls
[rootclr ~]# alias
alias cpcp -i
alias lsls –colorauto[rootclr ~]# which history #查看内部命令history在系统中的位置
/usr/bin/which: no history in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)[rootclr ~]# which java #查看外部命令java在系统中的位置
/usr/bin/java[rootclr ~]# which vlan # #查看内部命令vlan在系统中的位置(内部命令在系统中无法查询所在位置)
/usr/bin/which: no vlan in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) which -a命令 1.1 whereis命令
whereis:查看文件的位置
whereis用于显示命令及相关文件的路径位置信息.
能够找到命令二进制程序、命令源代码、man帮助手册等相关的文件路径位置信息.
补充
whereis命令有别于find命令进行的全盘搜索whereis命令查找速度非常快因为它不是在磁盘中乱找而是在指定数据库中查询该数据库是Linux系统自动创建的包含有本地所有文件的信息每天自动更新一次。但正因为这样whereis命令的搜索结果会不即时比如刚添加的文件可能搜不到原因就是该数据库文件没有被更新管理人员手动执行updatedb命令进行更新即可。 whereis命令格式whereis [参数] 命令名 常用参数 whereis -b命令 [rootclr ~]# whereis -b svn #查找svn的相关信息
svn: /usr/bin/svn #返回svn在系统中的位置
[rootclr ~]# whereis -b tcp #查找tcp的相关信息
tcp:[rootclr ~]# whereis -b tomcat #查找tomcat的相关信息
tomcat:[rootclr ~]# whereis -b poweroff #系统中并未查询到tcp和tomcat的相关信息
poweroff: /usr/sbin/poweroff #返回poweroff在系统中的位置1.2 locate命令
locate:配合数据库查看文件位置
locate 通过搜寻系统内建文档数据库快速找到档案默认情况下 locate 命令在搜寻数据库时,比从整个硬盘搜寻资料快得多但较差劲的是 locate 所找到的档案若是最近才建立或刚更名的可能会找不到。
locate 与 find 命令相似可以使用如 、? 等进行正则匹配查找
[rootclr ~]# locate pwd #查找和pwd 相关的所有文件(文件名中包含 pwd
/etc/.pwd.lock
/usr/bin/pwd
/usr/bin/pwdx
/usr/include/pwd.h
/usr/lib/modules/3.10.0-1160.el7.x86_64/kernel/drivers/watchdog/hpwdt.ko.xz
/usr/lib64/cracklib_dict.pwd
/usr/lib64/python2.7/lib-dynload/spwdmodule.so
/usr/lib64/python2.7/site-packages/ldap/controls/pwdpolicy.py
/usr/lib64/python2.7/site-packages/ldap/controls/pwdpolicy.pyc[rootclr ~]# locate /etc/sh #搜索 etc 目录下所有以 sh 开头的文件
/etc/shadow
/etc/shadow-
/etc/shells1.3 搜索文件命令总结
which:查看可执行文件的位置
whereis:查看文件的位置
locate:配合数据库查看文件位置
find:实际搜寻硬盘查询文件名称
2.find命令 采用递归方式,根据目标的名称、类型、大小等不同属性进行精细查找
find命令格式 常用查找条件类型 注意-type选项中不加f/d时默认会将文件和目录都查找并显示出来。 find -name命令 [rootclr ~]# cd /boot/
[rootclr /boot]# ls
config-3.10.0-1160.el7.x86_64
efi
grub
grub2
initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img
initramfs-3.10.0-1160.el7.x86_64.img[rootclr /boot]# ll -h #以人性化长格式方式详细显示/boot目录下的子目录以及文件
总用量 121M
-rw-r–r–. 1 root root 150K 10月 20 2020 config-3.10.0-1160.el7.x86_64
drwx——. 3 root root 17 7月 29 2020 efi
drwxr-xr-x. 2 root root 27 3月 23 00:42 grub
drwx——. 5 root root 97 3月 23 00:54 grub2
-rw——-. 1 root root 77M 3月 23 00:44 initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img
-rw——-. 1 root root 28M 3月 23 00:54 initramfs-3.10.0-1160.el7.x86_64.img[rootclr /boot]# find ./ -name initramfs* #查找当前目录下以initramfs字符串开头的文件
./initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img
./initramfs-3.10.0-1160.el7.x86_64.imgfind -size命令 [rootclr /boot]# find /boot/ -size 10M #查找并显示/boot/目录下文件大小大于10M的文件
/boot/initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img
/boot/initramfs-3.10.0-1160.el7.x86_64.img
各表达式之间使用逻辑运算符 “-a” 表示 而且 and “-o” 表示 或者or find -a命令 [rootclr /boot]# find /boot/ -size -5M -a -type f #查找并显示/boot目录下小于5M的文件
/boot/efi/EFI/centos/BOOT.CSV
/boot/efi/EFI/centos/BOOTX64.CSV
/boot/efi/EFI/centos/MokManager.efi
/boot/efi/EFI/centos/mmx64.efi
/boot/efi/EFI/centos/shim.efi
/boot/efi/EFI/centos/shimx64-centos.efi
/boot/efi/EFI/centos/shimx64.efi
/boot/efi/EFI/centos/fwupia32.efi
/boot/efi/EFI/centos/fwupx64.efifind -o命令 [rootclr /boot]# find ./ -name .img -o -name vmlinuz #查找当前目录下以“.img”结尾或者以vmlinuz字符串开头的文件和目录
./grub2/i386-pc/core.img
./grub2/i386-pc/boot.img
./vmlinuz-3.10.0-1160.el7.x86_64
./initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img
./vmlinuz-0-rescue-675c23e85f174b7ca25013149d0b69ad
./initramfs-3.10.0-1160.el7.x86_64.imgfind -type f命令 [rootclr /boot]# find /boot/ -size 20M -a -name *.img -a -type f #查看并显示/boot/目录下以“.img”结尾并且超过20M大小的文件
00/boot/initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img
/boot/initramfs-3.10.0-1160.el7.x86_64.imgfind -mtime命令 [rootclr ~]# find ./ -mtime 2 -exec ls -l {} \;#查看并显示当前目录下2天以前的文件和目录将该查询的结果作为参数传递给-exec命令最后以长格式方式显示出来
-rw-r–r–. 1 root root 18 12月 29 2013 ./.bash_logout
-rw-r–r–. 1 root root 176 12月 29 2013 ./.bash_profile
-rw-r–r–. 1 root root 176 12月 29 2013 ./.bashrc
-rw-r–r–. 1 root root 100 12月 29 2013 ./.cshrc
-rw-r–r–. 1 root root 129 12月 29 2013 ./.tcshrc
-rw——-. 1 root root 1832 3月 23 00:54 ./anaconda-ks.cfg
总用量 12
drwxr-xr-x. 2 root root 52 3月 29 15:07 abrt
drwx——. 2 root root 18 3月 23 00:55 dconf
-rw-r–r–. 1 root root 12288 3月 23 03:33 event-sound-cache.tdb.675c23e85f174b7ca25013149d0b69ad.x86_64-redhat-linux-gnu[rootclr ~]# find ./ -mtime 30 -exec ls -l {} \;#查看并显示当前目录下一个月以前的文件和目录将该查询的结果作为参数传递给-exec命令最后以长格式方式显示出来
-rw-r–r–. 1 root root 18 12月 29 2013 ./.bash_logout
-rw-r–r–. 1 root root 176 12月 29 2013 ./.bash_profile
-rw-r–r–. 1 root root 176 12月 29 2013 ./.bashrc
-rw-r–r–. 1 root root 100 12月 29 2013 ./.cshrc
-rw-r–r–. 1 root root 129 12月 29 2013 ./.tcshr[rootclr ~]# find ./ -mtime 30 -exec rm -f {} \;
#查看当前目录下一个月以前的文件和目录并将该查询结果作为参数传递给-exec命令最后强制删除[rootclr ~]# find ./ -mtime -30 -exec ls -l {} \;#查看当前目录下30天以内的文件和目录并将该查询结果作为参数传递给-exec命令最后显示出来
总用量 32
drwxr-xr-x. 2 root root 20 3月 28 14:11 123.txt
-rw-r–r–. 1 root root 14 3月 27 23:09 2.txt.bz2
-rw-r–r–. 1 root root 0 3月 27 23:09 3344.txt
-rw-r–r–. 1 root root 4 3月 28 14:12 456.txt
-rw-r–r–. 1 root root 3076 3月 28 14:26 abc456
-rw-r–r–. 1 root root 0 3月 28 16:36 abc.tat
-rw-r–r–. 1 root root 74 3月 28 22:37 abc.txt
-rw——-. 1 root root 1832 3月 23 00:54 anaconda-ks.cfg
drwxr-xr-x. 6 root root 4096 3月 27 16:37 gzy[rootclr ~]# find ./ -mtime 2 -exec ls -l {} \;#查看当前目录下2天之前一天内的文件和目录并将该查询结果作为参数传递给-exec命令最后显示出来
总用量 8
-rw-r–r–. 1 root root 1063 3月 27 08:41 log
-rw-r–r–. 1 root root 1063 3月 24 16:01 log.bak
-rw-r–r–. 1 root root 1063 3月 27 08:41 ./.cache/imsettings/log
总用量 3316
-rw-r–r–. 1 root root 11 3月 23 01:07 db-locale.txt
-rw-r–r–. 1 root root 2 3月 23 01:07 db-version.txt
-rw-r–r–. 1 root root 6 3月 23 01:07 first-index.txt
-rw-r–r–. 1 root root 10 3月 23 01:07 last-crawl.txt
-rw-r–r–. 1 root root 11 3月 27 08:41 locale-for-miner-apps.txt
-rw-r–r–. 1 root root 11 3月 27 08:41 locale-for-miner-user-guides.txt
-rw-r–r–. 1 root root 1634304 3月 23 11:04 meta.db
-rw-r–r–. 1 root root 32768 3月 27 23:54 meta.db-shm
-rw-r–r–. 1 root root 1338328 3月 27 23:54 meta.db-wal
-rw-r–r–. 1 root root 356412 3月 23 01:07 ontologies.gvdb
-rw-r–r–. 1 root root 40 3月 23 01:07 parser-sha1.txt
-rw-r–r–. 1 root root 11 3月 27 08:41 ./.cache/tracker/locale-for-miner-user-guides.txt
-rw-r–r–. 1 root root 11 3月 27 08:41 ./.cache/tracker/locale-for-miner-apps.txt find -delete用法 [rootclr /boot]# find ./ -name *.img -delete #查看当前目录下以“.img”结尾的文件和目录并且将该查询结果删除find -inmu命令 [rootclr /boot]# ll -i #查看当前目录下目录和文件的inode号
总用量 1236241234000 -rw-r–r–. 1 root root 153591 10月 20 2020 config-3.10.0-1160.el7.x86_6433556200 drwx——. 3 root root 17 7月 29 2020 efi
101413155 drwxr-xr-x. 2 root root 27 3月 23 00:42 grub67146888 drwx——. 5 root root 97 3月 23 00:54 grub22752025 -rw——-. 1 root root 79724349 3月 23 00:44 initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img1275566 -rw——-. 1 root root 29226758 3月 23 00:54 initramfs-3.10.0-1160.el7.x86_64.img1234001 -rw-r–r–. 1 root root 320648 10月 20 2020 symvers-3.10.0-1160.el7.x86_64.gz1233999 -rw——-. 1 root root 3616707 10月 20 2020 System.map-3.10.0-1160.el7.x86_642752000 -rwxr-xr-x. 1 root root 6769256 3月 23 00:44 vmlinuz-0-rescue-675c23e85f174b7ca25013149d0b69ad1234002 -rwxr-xr-x. 1 root root 6769256 10月 20 2020 vmlinuz-3.10.0-1160.el7.x86_64[rootclr /boot]# find ./ -inum 2752000 #查找当前目录下inode号为2752000的文件或目录
./vmlinuz-0-rescue-675c23e85f174b7ca25013149d0b69ad2.1 find之exec用法 -exec参数后面跟的是Linux命令它是以分号“;”为结束标志由于各个系统中分号会有不同的意义因此在分号前面加上反斜杠转义符“\”。 {}代表前面find查找出来的文件名。
find命令匹配到了当前目录下的所有普通文件并在-exec选项中使用Ils -l命令将它们列出;
find ./ -type f -exec ls -l {} ;
[rootclr /boot]# find /boot/ -size 20M -a -name *.img -a -type f -exec ls -l {} \; ##查找当前目录下以“.img”结尾或者以vmlinuz字符串开头的文件和目录,并将查询结果作为参数传递给-exec命令最后以长格式方式显示查询出来的文件信息
-rw——-. 1 root root 79724349 3月 23 00:44 /boot/initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img
-rw——-. 1 root root 29226758 3月 23 00:54 /boot/initramfs-3.10.0-1160.el7.x86_64.img 2.2 管道符之xargs用法
[rootclr /boot]# find ./ -name *.img | xargs ls -l #查看并显示当前目录下以“.img”结尾的文件和目录并将该查询结果作为参数传递给管道符的xargs,最后以长格式方式显示出来
-rw-r–r–. 1 root root 512 3月 23 00:45 ./grub2/i386-pc/boot.img
-rw-r–r–. 1 root root 26852 3月 23 00:45 ./grub2/i386-pc/core.img
-rw——-. 1 root root 79724349 3月 23 00:44 ./initramfs-0-rescue-675c23e85f174b7ca25013149d0b69ad.img
-rw——-. 1 root root 29226758 3月 23 00:54 ./initramfs-3.10.0-1160.el7.x86_64.img
3 Linux常用命令 4.命令执行优先级
第一优先级指定路径的命令。绝对路径 /usr/bin/ls 或者相对路径 cd /usr/bin ./ls
第二优先级别名指定的命令 alias myls‘/usr/bin/ls -alh’
第三优先级内部命令
第四优先级hash 命令
linux系统下会有一个hash表当你刚开机时这个hash表为空每当你执行过一条命令时hash表会记录下这条命令的路径就相当于缓存一样。第一次执行命令shell解释器默认的会从PATH路径下寻找该命令的路径当你第二次使用该命令时shell解释器首先会查看hash表没有该命令才会去PATH路径下寻找。hash表能提高命令的调用速率。
第五优先级通过PATH 定义的路径顺序查找
如果以上顺序都找不到就会报“未找到命令…”的错误。
- 上一篇: 网站建设辶金手指排名十三自建站价格
- 下一篇: 网站建设最基础的是什么意思丽江建设公司网站
相关文章
-
网站建设辶金手指排名十三自建站价格
网站建设辶金手指排名十三自建站价格
- 技术栈
- 2026年03月21日
-
网站建设总结报告书wordpress+帖子置顶
网站建设总结报告书wordpress+帖子置顶
- 技术栈
- 2026年03月21日
-
网站建设综合实训总结个人网站能否备案
网站建设综合实训总结个人网站能否备案
- 技术栈
- 2026年03月21日
-
网站建设最基础的是什么意思丽江建设公司网站
网站建设最基础的是什么意思丽江建设公司网站
- 技术栈
- 2026年03月21日
-
网站建设最简单的教程php网站开发开发网站教程
网站建设最简单的教程php网站开发开发网站教程
- 技术栈
- 2026年03月21日
-
网站建设最难的部分微信开发者文档小程序
网站建设最难的部分微信开发者文档小程序
- 技术栈
- 2026年03月21日
