Bo's Oracle Station

查看: 2507|回复: 0

课程第17次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-5-19 20:02:54 | 显示全部楼层 |阅读模式
2019-05-19
逻辑卷相同的写法:
/dev/mapper/vg_install-lv_home/   === /dev/vg_install/lv_home

kvm虚拟机的盘/dev/vda...                                   xen虚拟机的盘/dev/xvda...
如果要跨设备做硬链接,那么:
  1. [root@station60 ~]# ln anaconda-ks.cfg  /mnt/anaconda-ks2.cfg
  2. ln: failed to create hard link ‘/mnt/anaconda-ks2.cfg’ => ‘anaconda-ks.cfg’: Invalid cross-device link
  3. [root@station60 ~]# cd /mnt
  4. [root@station60 mnt]# ls
  5. lost+found
  6. [root@station60 mnt]# touch anaconda-ks2.cfg
  7. [root@station60 mnt]# cd
  8. [root@station60 ~]# ls
  9. anaconda-ks.cfg  a.txt  Desktop  Documents  Downloads  initial-setup-ks.cfg  labs  Music  Pictures  Public  rpmbuild  Templates  Videos
  10. [root@station60 ~]# mount  --bind anaconda-ks.cfg  /mnt/
  11. anaconda-ks2.cfg  lost+found/      
  12. [root@station60 ~]# mount  --bind anaconda-ks.cfg  /mnt/anaconda-ks2.cfg
  13. [root@station60 ~]# cd /mnt
  14. [root@station60 mnt]# ls
  15. anaconda-ks2.cfg  lost+found
  16. [root@station60 mnt]# vim anaconda-ks2.cfg
  17. [root@station60 mnt]# ls -i anaconda-ks2.cfg
  18. 33574992 anaconda-ks2.cfg
  19. [root@station60 mnt]# ls -i /root/anaconda-ks.cfg
  20. 33574992 /root/anaconda-ks.cfg
复制代码
对比一下grep -r:
  1. [root@station60 etc]# grep  --color  -r updatedb   ./
  2. ./cron.daily/mlocate:/usr/bin/updatedb -f "$nodevs"
  3. ./selinux/targeted/contexts/files/file_contexts:/usr/bin/updatedb.*        --        system_u:object_r:locate_exec_t:s0
  4. Binary file ./selinux/targeted/contexts/files/file_contexts.bin matches
  5. ./selinux/targeted/active/file_contexts:/usr/bin/updatedb.*        --        system_u:object_r:locate_exec_t:s0
  6. ./sudoers:# Cmnd_Alias LOCATE = /usr/bin/updatedb
复制代码
关于RHEL7  RH124 P353的单引号:
  1. #!/bin/sh

  2. read -p "Pls input what do want to  find?: "  MYFND

  3. find / -name '$MYFND'
复制代码
  1. #!/bin/sh

  2. read -p "Pls input what do want to  find?: "  MYFND

  3. find / -name "$MYFND"
复制代码
[root@station60 ~]# ./1.sh
Pls input what do want to  find?: a.txt
[root@station60 ~]# vi 1.sh
[root@station60 ~]# ./1.sh
Pls input what do want to  find?: a.txt
/root/a.txt

在man find的时候,搜索-i.../\-i

找到了-inum,举个例子:
  1. find  / -inum 51620756
复制代码

RH124 P355:
  1. find / -user root -group mail 2>/dev/null
复制代码

与下面这条命令等价:
  1. find / -user root  -a   -group mail 2>/dev/null
复制代码
一个相对复杂的例子:
  1. find / \( ! -user root  -a   -group mail \)  -o  \( -perm  1777 -a  -type d \)    2>/dev/null
  2. /dev/mqueue
  3. /dev/shm
  4. /var/tmp
  5. /var/tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-rtkit-daemon.service-Bwn1dH/tmp
  6. /var/tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-bolt.service-n4k8OH/tmp
  7. /var/tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-colord.service-cXOTvV/tmp
  8. /var/tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-chronyd.service-53kvac/tmp
  9. /var/tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-rtkit-daemon.service-Rj9tdi/tmp
  10. /var/tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-cups.service-dtaLzq/tmp
  11. /var/tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-bolt.service-mlcgv6/tmp
  12. /var/tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-colord.service-hESX1M/tmp
  13. /var/tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-fwupd.service-myYryr/tmp
  14. /var/tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-rtkit-daemon.service-LHQmRy/tmp
  15. /var/tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-chronyd.service-YrgDso/tmp
  16. /var/tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-cups.service-ilgZY5/tmp
  17. /var/tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-bolt.service-zlAGWI/tmp
  18. /var/tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-colord.service-edBOIi/tmp
  19. /var/tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-cups.service-uGftV4/tmp
  20. /var/tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-fwupd.service-cnCsBc/tmp
  21. /var/spool/mail/rpc
  22. /var/spool/mail/student
  23. /tmp
  24. /tmp/.ICE-unix
  25. /tmp/.X11-unix
  26. /tmp/.XIM-unix
  27. /tmp/.font-unix
  28. /tmp/.Test-unix
  29. /tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-fwupd.service-0zDd1f/tmp
  30. /tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-bolt.service-HFNoCw/tmp
  31. /tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-colord.service-w5iYWR/tmp
  32. /tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-cups.service-koA7u1/tmp
  33. /tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-bolt.service-5fEpCi/tmp
  34. /tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-chronyd.service-2Pv1q9/tmp
  35. /tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-fwupd.service-rxM7b5/tmp
  36. /tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-rtkit-daemon.service-9CYYbf/tmp
  37. /tmp/systemd-private-3a18d86c83ae4176a15ef08834c46d31-colord.service-kD7yLW/tmp
  38. /tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-rtkit-daemon.service-3p8gom/tmp
  39. /tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-bolt.service-6wLctG/tmp
  40. /tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-chronyd.service-bzEXjb/tmp
  41. /tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-cups.service-D7dcLu/tmp
  42. /tmp/systemd-private-2815a723c0f04a8c976237997cb924dd-colord.service-JRTsP0/tmp
  43. /tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-cups.service-4e0VMs/tmp
  44. /tmp/systemd-private-4ebe4ae4397b4c52aab071bcdfc903a1-rtkit-daemon.service-LwaPxK/tmp
  45. [root@station60 ~]#
复制代码
  1. [root@station60 labs2]# find ./ -perm  442
  2. ./a.txt
  3. [root@station60 labs2]# find ./ -perm  /442
  4. ./
  5. ./a.txt
  6. ./b.txt
  7. [root@station60 labs2]# find ./ -perm  -442
  8. ./a.txt
  9. ./b.txt
  10. [root@station60 labs2]# touch c.txt
  11. [root@station60 labs2]# chmod 440  c.txt
  12. [root@station60 labs2]# find ./ -perm  -442
  13. ./a.txt
  14. ./b.txt
  15. [root@station60 labs2]# find ./ -perm  /442
  16. ./
  17. ./a.txt
  18. ./b.txt
  19. ./c.txt
  20. [root@station60 labs2]# 类似 select    where  all/any
复制代码

关于搜索的层数:
  1. [root@station60 ~]# find / -iname "*message*" -maxdepth 3
  2. find: warning: you have specified the -maxdepth option after a non-option argument -iname, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.

  3. /var/log/messages-20190510
  4. /var/log/messages-20190512
  5. /var/log/messages
  6. /usr/bin/sdp_long_message
  7. /usr/bin/metacity-message
  8. [root@station60 ~]# find /  -maxdepth 3   -iname "*message*"
  9. /var/log/messages-20190510
  10. /var/log/messages-20190512
  11. /var/log/messages
  12. /usr/bin/sdp_long_message
  13. /usr/bin/metacity-message
复制代码










回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-4 01:22 , Processed in 0.036773 second(s), 25 queries .

快速回复 返回顶部 返回列表