当前位置: 首页 > news >正文

中国嘉兴门户网站做网站东莞

中国嘉兴门户网站,做网站东莞,受欢迎的建网站哪家好,linux下做网站1.find介绍 linux查找命令find是linux运维中很重要、很常用的命令之一#xff0c;find用于根据指定条件的匹配参数来搜索和查找文件和目录列表#xff0c;我们可以通过权限、用户、用户组、文件类型、日期、大小等条件来查找文件。 2.find语法 find语法 find [查找路径] …1.find介绍 linux查找命令find是linux运维中很重要、很常用的命令之一find用于根据指定条件的匹配参数来搜索和查找文件和目录列表我们可以通过权限、用户、用户组、文件类型、日期、大小等条件来查找文件。 2.find语法 find语法 find [查找路径] [查找条件] [处理动作] 查找路径指定的具体目标路径  查找条件指定的查找标准可以是权限、用户、用户组、文件类型、日期、大小等标准进行  处理动作对符合条件的文件做相关操作比如输出屏幕存放至某个文件中 3.样例 3.1.根据文件名称使用find命令进行查找 -在当前工作目录中查找名称为ztj.txt的文件 命令 find ztj.txt OR find . -name ztj.txt -maxdepth 1 [rootrhel77 ~]# find ztj.txt ztj.txt [rootrhel77 ~]# find . -name ztj.txt -maxdepth 1 find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments../ztj.txt [rootrhel77 ~]# -在/root目录下查找名称为ztj.txt的所有文件 命令 find /root -name ztj.txt [rootrhel77 ~]# find /root -name ztj.txt /root/1/ztj.txt /root/ztj.txt /root/ztj11/ztj.txt [rootrhel77 ~]# -在/root目录中查找名称为z的所有目录 命令 find /root -type d -name z [rootrhel77 ~]# find /root -type d -name z /root/z [rootrhel77 ~]# 其中-type类型参数介绍如下 f普通文件 l符号链接 d目录 c字符设备 b块设备 s套接字 -在/root目录下查找所有以.zip和.log为扩展名的文件 命令 find /root -type f \( -name *.zip -o -name *.log \) -ls [rootrhel77 ~]# find /root -type f \( -name *.zip -o -name *.log \) -ls 1731369 80 -rw-r--r-- 1 root root 81141 May 4 16:13 /root/wordpress_auto_install.log 1731610 4 -rw-r--r-- 1 root root 2059 Jul 28 15:14 /root/ztj.zip 3269480 4 -rw-r--r-- 1 root root 586 May 17 22:19 /root/disk.log 3257826 40 -rw-r--r-- 1 root root 40739 May 25 14:01 /root/extundelete-0.2.4/config.log 1731382 4 -rw-r--r-- 1 root root 642 Jul 21 14:04 /root/1.zip 1731605 4 -rw-r--r-- 1 root root 106 Aug 10 09:10 /root/urandom.log 1731400 4 -rw-r--r-- 1 root root 1475 Jul 21 14:08 /root/2.zip70 4 -rw-r--r-- 1 root root 3334 Jul 20 08:50 /root/z.zip 3256369 4 -rw-r--r-- 1 root root 48 May 19 09:07 /root/zt1.log [rootrhel77 ~]# -在/root目录下查找所有以.png.jpg.php和.js为扩展名的文件 命令 find /root -type f \( -name *.png -o -name *.jpg -o -name *.php -o -name *.js \) -ls   [rootrhel77 ~]# find /root -type f \( -name *.png -o -name *.jpg -o -name *.php -o -name *.js \) -ls 3247961 0 -rw-r--r-- 1 root root 0 Aug 17 14:25 /root/1.png 3247965 0 -rw-r--r-- 1 root root 0 Aug 17 14:25 /root/2.jpg 3247966 0 -rw-r--r-- 1 root root 0 Aug 17 14:25 /root/3.php 3247967 0 -rw-r--r-- 1 root root 0 Aug 17 14:25 /root/4.js [rootrhel77 ~]# 3.2.根据文件权限使用find命令进行查找 -在/root目录下查找权限为777的文件 命令 find /root -type f -perm 0777  -maxdepth 1 -ls [rootrhel77 ~]# find /root -type f -perm 0777 -maxdepth 1 -ls find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.1731602 160 -rwxrwxrwx 1 root root 160059 Aug 16 09:56 /root/abc.txt 3256377 4 -rwxrwxrwx 1 root root 259 May 23 16:48 /root/user_info.txt [rootrhel77 ~]# -在/root目录下查找权限不是777的文件 命令 find /root -type f ! -perm 777  -maxdepth 1 -ls [rootrhel77 ~]# find /root -type f ! -perm 777 -maxdepth 1 -ls | tail -n 5 find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.3256384 4 -rwxr-xr-x 1 root root 988 May 23 22:33 /root/fdisk.sh 3257852 4 -rw-r--r-- 1 root root 62 May 27 14:42 /root/1234.txt 430437 4 -rwxr-xr-x 1 root root 64 Jun 5 21:23 /root/ztj-1.sh 1731615 4 -rwxr-xr-x 1 root root 21 Jun 7 13:55 /root/uuidgen.sh 430376 4 -rw-r--r-- 1 root root 41 Jul 21 13:59 /root/zzz.txt.bz2 [rootrhel77 ~]# -在/root目录下查找权限为777的目录将其权限设置为755 命令 find /root -type d -perm 777 -maxdepth 1 -ls -exec chmod 755 {} \;   [rootrhel77 ~]# find /root -type d -perm 777 -maxdepth 1 -ls -exec chmod 755 {} \; find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.69 12 drwxrwxrwx 24 root root 8192 Aug 16 09:27 /root 1729025 0 drwxrwxrwx 2 root root 90 Jul 20 10:29 /root/test-在/root目录下查找名称为cc.txt文件并将其删除 命令 find /root -type f -name cc.txt -maxdepth 1 | xargs rm -rf [rootrhel77 ~]# find /root -type f -name cc.txt -maxdepth 1 | xargs rm -rf find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.[rootrhel77 ~]# OR find /root -type f -name cc.txt -maxdepth 1 -exec rm -rf {} \; [rootrhel77 ~]# find /root -type f -name cc.txt -maxdepth 1 -exec rm -rf {} \; find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.[rootrhel77 ~]# -在/root目录下找出权限是600的文件 命令 find /root/ -perm 600 -ls [rootrhel77 ~]# find /root/ -perm 600 -ls 3698739 4 -rw------- 1 root root 1679 Apr 27 14:09 /root/.ssh/id_rsa1601 16 -rw------- 1 root root 14605 Aug 17 10:03 /root/.bash_history 3247958 8 -rw------- 1 root root 5648 Aug 17 10:03 /root/.viminfo 1731372 0 -rw------- 1 alice alice 0 May 27 21:04 /root/test/alice.txt 202108776 4 -rw------- 1 root root 11 Aug 17 13:32 /root/.cache/abrt/lastnotification 542180 4 -rw------- 1 root root 312 Aug 10 08:51 /root/.lesshst 3247962 4 -rw------- 1 root root 312 Aug 17 13:32 /root/.Xauthority 1731398 4 -rw------- 1 root root 306 Aug 10 09:08 /root/nohup.out 3256372 4 -rw------- 1 root root 15 Jul 17 08:35 /root/.lvm_history 3547010 4 -rw------- 1 root root 18 Jun 4 12:00 /root/.mysql_history [rootrhel77 ~]# 上述命令(find /root/ -perm 600 -ls)会找到所有只有rw-------权限的文件。 另外 如下命令 find /root/ -perm -600 -ls -600表示列出只要是包括了rw的其它位任意的文件 [rootrhel77 ~]# find /root/ -perm -600 -ls |head -n 1069 16 drwxr-xr-x 24 root root 12288 Aug 17 13:32 /root/ 3180996 4 -rwxr-xr-x 1 root root 79 Apr 11 09:55 /root/access.sh 135138217 0 drwxr-xr-x 2 root root 6 Apr 24 19:08 /root/110 502725 4 -rw-r--r-- 1 root root 18 Dec 29 2013 /root/.bash_logout 542640 4 -rwxr-xr-x 1 root root 192 Mar 15 09:25 /root/earth-1.sh 1729048 4 -rw-r--r-- 1 root root 57 Mar 16 15:57 /root/symlinks-1.list 542203 4 -rwxr-xr-x 1 root root 94 Mar 30 13:57 /root/apache-1.sh 3193035 4 -rwxr-xr-x 1 root root 207 Apr 18 22:22 /root/spawn.sh 502727 4 -rw-r--r-- 1 root root 176 Dec 29 2013 /root/.bashrc 3181007 4 -rwxr-xr-x 1 root root 155 Apr 11 14:05 /root/case-2.sh [rootrhel77 ~]# 如下命令 find /root/ -perm /600 -ls /600表示列出指定的权限符合r--------或w--------的文件。 [rootrhel77 ~]# find /root/ -perm /600 -ls |head -n 1069 16 drwxr-xr-x 24 root root 12288 Aug 17 13:32 /root/ 3180996 4 -rwxr-xr-x 1 root root 79 Apr 11 09:55 /root/access.sh 135138217 0 drwxr-xr-x 2 root root 6 Apr 24 19:08 /root/110 502725 4 -rw-r--r-- 1 root root 18 Dec 29 2013 /root/.bash_logout 542640 4 -rwxr-xr-x 1 root root 192 Mar 15 09:25 /root/earth-1.sh 1729048 4 -rw-r--r-- 1 root root 57 Mar 16 15:57 /root/symlinks-1.list 542203 4 -rwxr-xr-x 1 root root 94 Mar 30 13:57 /root/apache-1.sh 3193035 4 -rwxr-xr-x 1 root root 207 Apr 18 22:22 /root/spawn.sh 502727 4 -rw-r--r-- 1 root root 176 Dec 29 2013 /root/.bashrc 3181007 4 -rwxr-xr-x 1 root root 155 Apr 11 14:05 /root/case-2.sh [rootrhel77 ~]# 3.3.基于文件所有者和所属组使用find命令进行查找 -在/root目录下找出文件所有者为root名称为ztj.txt的文件 命令 find /root/ -user root -name ztj.txt -ls [rootrhel77 ~]# find /root/ -user root -name ztj.txt -ls 68916551 4 -rw-r--r-- 1 root root 28 Mar 30 16:54 /root/1/ztj.txt 3247948 0 -rw-r--r-- 1 root root 0 Aug 4 10:00 /root/ztj.txt 203522440 4 -rw-r--r-- 1 root root 4 Apr 23 2022 /root/ztj11/ztj.txt [rootrhel77 ~]# -在/root目录下找出文件属组为root文件名称为process.txt的文件 命令 find /root/ -group root -name process.txt -ls [rootrhel77 ~]# find /root/ -group root -name process.txt -ls 1731367 48 -rw-r--r-- 1 root root 48638 May 16 16:43 /root/process.txt [rootrhel77 ~]# -在/root目录查找所有者为root的所有.txt文件 命令 find /root -user root -iname *.txt -ls 其中 -iname忽略name的大小写版本 [rootrhel77 ~]# find /root -user root -iname *.txt -ls 1731370 4 -rw-r--r-- 3 root root 8 May 27 21:29 /root/test/a.txt 1731370 4 -rw-r--r-- 3 root root 8 May 27 21:29 /root/test/b.txt 1731370 4 -rw-r--r-- 3 root root 8 May 27 21:29 /root/test/d.txt 3181009 4 -rw-r--r-- 1 root root 14 Mar 23 15:18 /root/all.txt 3193028 4 -rw-r--r-- 1 root root 604 Apr 18 13:36 /root/system.txt 542186 4 -rw-r--r-- 1 root root 6 Mar 1 14:33 /root/bb.txt 1555878 4 -rw-r--r-- 1 root root 9 Jun 5 21:41 /root/user.txt 3193757 4 -rw-r--r-- 1 root root 154 Apr 26 08:56 /root/test.txt 137253126 4 -rw-r--r-- 1 root root 37 Aug 4 09:57 /root/123/zzz.txt 137119752 4 -rw-r--r-- 1 root root 6 Mar 15 10:12 /root/2/bb.txt 430370 4 -rw-r--r-- 1 root root 37 Aug 4 09:55 /root/zzz.txt 137259616 4 -rw-r--r-- 1 root root 3 May 27 17:05 /root/z/aa.txt 68916537 4 -rw-r--r-- 1 root root 2 Mar 30 16:54 /root/1/aa.txt 68916539 4 -rw-r--r-- 1 root root 14 Mar 30 16:54 /root/1/all.txt 68916543 4 -rw-r--r-- 1 root root 6 Mar 30 16:54 /root/1/bb.txt 68916545 4 -rw-r--r-- 1 root root 464 Mar 30 16:54 /root/1/cc.txt 68916547 4 -rw-r--r-- 1 root root 6 Mar 30 16:54 /root/1/user.txt 68916551 4 -rw-r--r-- 1 root root 28 Mar 30 16:54 /root/1/ztj.txt 3698754 4 -r--r--r-- 1 root root 10 Apr 28 08:58 /root/gg.txt 1731602 180 -rwxrwxrwx 1 root root 183335 Aug 17 13:54 /root/abc.txt 1731374 4 -rw-r--r-- 1 root root 58 May 13 20:12 /root/online.txt 1731378 4 -rw-r--r-- 1 root root 1636 May 13 20:12 /root/offline.txt 3269441 4 -rw-r--r-- 1 root root 132 May 9 22:15 /root/off.txt 3269442 4 -rw-r--r-- 1 root root 1 May 9 22:15 /root/on.txt 3269445 4 -rw-r--r-- 1 root root 1794 May 19 09:18 /root/a.txt 1731367 48 -rw-r--r-- 1 root root 48638 May 16 16:43 /root/process.txt 3247948 0 -rw-r--r-- 1 root root 0 Aug 4 10:00 /root/ztj.txt 1731387 4 -rw-r--r-- 1 root root 361 May 29 19:53 /root/1.txt 3193031 4 -rw-r--r-- 1 root root 56 Apr 20 10:52 /root/v.txt 1731403 512000 -rw-r--r-- 1 root root 524288000 May 31 08:42 /root/boc.txt 1729071 0 -rw-r--r-- 1 root root 0 Jul 20 08:33 /root/DDA/ztj/1.txt 1731379 0 -rw-r--r-- 1 root root 0 Jul 20 08:34 /root/DDA/ztj/2.txt 1731391 0 -rw-r--r-- 1 root root 0 Jul 20 08:34 /root/DDA/ztj/3.txt 1731394 0 -rw-r--r-- 1 root root 0 Jul 20 08:34 /root/DDA/ztj/4.txt 1731404 0 -rw-r--r-- 1 root root 0 Jul 20 08:34 /root/DDA/ztj/5.txt 1731406 0 -rw-r--r-- 1 root root 0 Jul 20 08:34 /root/DDA/ztj/6.txt 3698742 4 -rw-r--r-- 1 root root 102 Apr 23 21:12 /root/brace.txt 3247960 0 -rw-r--r-- 1 root root 0 Aug 17 13:53 /root/tttt.TXT 203522440 4 -rw-r--r-- 1 root root 4 Apr 23 2022 /root/ztj11/ztj.txt 203522446 0 lrwxrwxrwx 1 root root 7 Apr 23 2022 /root/ztj11/aa.txt - ztj.txt 3256377 4 -rwxrwxrwx 1 root root 259 May 23 16:48 /root/user_info.txt 430371 4 -rw-r--r-- 1 root root 2137 Aug 4 09:55 /root/zzza.txt 3698759 0 lrwxrwxrwx 1 root root 7 Apr 28 09:06 /root/hh.txt - ztj.txt 430369 4 -rw-r--r-- 1 root root 23 Jul 19 08:38 /root/ztj1.txt 3269443 4 -rw-r--r-- 1 root root 52 May 19 09:18 /root/b.txt 1731368 4 -rw-r--r-- 1 root root 892 May 16 16:56 /root/stat.txt 3256365 4 -rw-r--r-- 1 root root 6 May 18 21:01 /root/22.txt 3257852 4 -rw-r--r-- 1 root root 62 May 27 14:42 /root/1234.txt [rootrhel77 ~]# 3.4.根据文件日期和时间使用find命令进行查找 linux系统里面的文件都有三种属性 访问(access)时间-atime/天-amin/分钟用户最近一次访问时间 修改(modify)时间-mtime/天-mmin/分钟文件最后一次修改时间 变化(change)时间-ctime/天-cmin/分钟文件元数据例如权限、属性等最后一次修改时间 -在/root目录下查找50天外修改的所有文件 命令 find /root -mtime 50 -ls [rootrhel77 ~]# find /root -mtime 50 -ls |head -n 10 3180996 4 -rwxr-xr-x 1 root root 79 Apr 11 09:55 /root/access.sh 135138217 0 drwxr-xr-x 2 root root 6 Apr 24 19:08 /root/110 502725 4 -rw-r--r-- 1 root root 18 Dec 29 2013 /root/.bash_logout 542640 4 -rwxr-xr-x 1 root root 192 Mar 15 09:25 /root/earth-1.sh 1729048 4 -rw-r--r-- 1 root root 57 Mar 16 15:57 /root/symlinks-1.list 542203 4 -rwxr-xr-x 1 root root 94 Mar 30 13:57 /root/apache-1.sh 3193035 4 -rwxr-xr-x 1 root root 207 Apr 18 22:22 /root/spawn.sh 502727 4 -rw-r--r-- 1 root root 176 Dec 29 2013 /root/.bashrc 3181007 4 -rwxr-xr-x 1 root root 155 Apr 11 14:05 /root/case-2.sh 502728 4 -rw-r--r-- 1 root root 100 Dec 29 2013 /root/.cshrc [rootrhel77 ~]# -在/root目录下查找最近1小时内修改的所有文件 命令 find /root -mmin -60 -ls   [rootrhel77 ~]# find /root -mmin -60 -ls69 16 drwxr-xr-x 24 root root 12288 Aug 17 13:53 /root 201482216 0 drwxr-xr-x 2 root root 30 Aug 17 13:32 /root/.cache/abrt 202108776 4 -rw------- 1 root root 11 Aug 17 13:32 /root/.cache/abrt/lastnotification 3247962 4 -rw------- 1 root root 312 Aug 17 13:32 /root/.Xauthority 1731602 180 -rwxrwxrwx 1 root root 184083 Aug 17 14:11 /root/abc.txt 3247960 0 -rw-r--r-- 1 root root 0 Aug 17 13:53 /root/tttt.TXT [rootrhel77 ~]# 3.5.根据文件大小使用find命令进行查找 -在/root目录下找到大小为15MB的文件 命令 find /root -size 15M -ls [rootrhel77 ~]# find /root -size 15M -ls 3268520 14924 -rw-r--r-- 1 root root 15279408 Jun 3 20:18 /root/mysql-community-server-minimal-5.7.42-1.el7.x86_64.rpm [rootrhel77 ~]# -在/root目录下找到大于1MB且小于16MB的所有文件 命令 find /root -size 1M -size -16M -ls [rootrhel77 ~]# find /root -size 1M -size -16M -ls 3268520 14924 -rw-r--r-- 1 root root 15279408 Jun 3 20:18 /root/mysql-community-server-minimal-5.7.42-1.el7.x86_64.rpm 3698723 8872 -rw-r--r-- 1 root root 9082696 Apr 30 07:09 /root/wordpress-4.9.4-zh_CN.tar.gz 69023364 1860 -rw-r--r-- 1 root root 1904320 May 25 14:01 /root/extundelete-0.2.4/src/extundelete-extundelete.o 69023371 1296 -rwxr-xr-x 1 root root 1323312 May 25 14:01 /root/extundelete-0.2.4/src/extundelete 1731386 10224 -rw-r--r-- 1 root root 10466248 May 29 13:50 /root/aa.tar.gz [rootrhel77 ~]# 3.6.基于inode删除ztj.txt文件(使用频率居高) 命令 ls -li ztj.txt find /root -inum 3247948 -exec rm -rf {} \; [rootrhel77 ~]# pwd /root [rootrhel77 ~]# ls -li ztj.txt 3247948 -rw-r--r-- 1 root root 0 Aug 4 10:00 ztj.txt [rootrhel77 ~]# find /root -inum 3247948 -ls 3247948 0 -rw-r--r-- 1 root root 0 Aug 4 10:00 /root/ztj.txt [rootrhel77 ~]# find /root -inum 3247948 -exec rm -rf {} \; [rootrhel77 ~]# ls -li ztj.txt ls: cannot access ztj.txt: No such file or directory [rootrhel77 ~]#
http://www.hkea.cn/news/14310163/

相关文章:

  • 莆田做网站价格长沙网上购物超市
  • 番禺网站建设策划网页界面设计作品
  • 网站建设合同英文河南省住房和城乡建设厅查询网站首页
  • 给企业做网站收入做企业网站哪家强
  • 网站代码加密了怎么做wordpress文章 页面
  • 网站切图是指什么美食网站 怎么做
  • 温州营销型网站建设采集更新wordpress
  • 网站域名注册基本流程wordpress 文章导航
  • 景区网站建设原则WordPress页面添加最新文章
  • 网站建设 全网推广android 移动网站开发
  • 网站建设最新新闻免费签名logo设计
  • 给蛋糕店做企业网站的文案视频网站如何做引流
  • 网站整站模板下载WordPress配置头像路径
  • 企业网站建设一条龙全包台州新农村建设网站
  • 广州seo网站管理360免费建站教程
  • dede修改网站密码网站开发的意义和目的
  • 网站建设捌金手指下拉三微信开发有哪两种
  • 邮箱账号做网站用户名好不好做征婚网站
  • 国外上市公司网站建设wordpress上传服务器域名
  • 企业二级网站怎么做前端 wordpress
  • 茂名百度搜索网站排名xml是用来做网站的嘛
  • 杨浦苏州网站建设工信部域名备案管理系统
  • 做网站的目标客户个人又什么办法做企业网站
  • 做百度推广需要有自己的网站吗优化建议
  • 做外汇网站代理赚钱吗阿里云wordpress外网访问不了
  • wordpress一键建站cms和wordpress
  • 大气黑色女性时尚类网站织梦模板装饰工程造价
  • h5网站杭州建网站
  • 宜都市网站建设seo优化的方法有哪些
  • 高端网站建设公司联系电话西安企业100强