find命令和dhcp服務

####文件查找####

1.locate filename       ##在文件數據庫中搜索filename信息,updatedb更新文件數據庫
2.find

find    查找位置    -條件 條件值  -exec 動作 {} \;     ##固定格式
            -name
            -not    條件
            -user
            -group
            -size
            -perm
            -maxdepth
            -mindepth
            -a
            -o
            -type   f   文件
                d   目錄
                c   字符設備
                b   塊設備
                s   套節字
                l   鏈接
1).根據用戶組查找              
find /mnt -user student         ##查找用戶是student的文件
find /mnt -group linux          ##查找組是linux的文件
find /mnt -user student -a -group linux ##兩個同時滿足
find /mnt -user student -o -group linux ##滿足一個條件即可 
find /mnt -user student -not -group linux   ##查找用戶是student而且組不是linux的文件
2).按權限查找
find /mnt -perm 444 ##u=g=o=4
find /mnt -perm -444    ##u g o都含有4
find /mnt -perm /444    ##u含有4或者g含有4或者o含有4(在企業6版本中用法是+444,用man函數確認後在使用)
find /mnt -perm -002    ##對u位g位沒有條件限制,o位含有2
3).按大小查找
創建三個文件並查看大小
dd if=/dev/zero of=/mnt/file1 bs=1024 count=10
dd if=/dev/zero of=/mnt/file2 bs=1024 count=20
dd if=/dev/zero of=/mnt/file3 bs=1024 count=30
du -sh *
查找
find /mnt -size 10k ##=10k
find /mnt -size -10k    ##<10k
find /mnt -size +10k    ##>10k
4).find -type -mindepth -maxdepth
find /etc -type l   ##連接
find /etc -type s   ##套接
find /etc -type d   ##目錄
find /etc -type f   ##文件
find /etc -type c   ##字符設備
find /etc -type b   ##塊設備
find /etc -type p   ##管道設備
find /etc -type -mindepth -maxdepth 搜索的最大最小深度

####dhcp服務####

1安裝dhcp軟件包並查看dhcp配置信息

yum install -y dhcp     ##需要提前配好yum源
cat /etc/dhcp/dhcpd.conf    ##查看dhcpd服務配置文件
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#

2拷貝並編輯dhcp配置文件

cp /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp: overwrite '/etc/dhcp/dhcpd.conf'? y

vim /etc/dhcp/dhcpd.conf
#  7 option domain-name "westos.com";
#  8 option domain-name-servers 172.25.254.117;
#  27 #subnet 10.152.187.0 netmask 255.255.255.0 {
#  28 #}            ##將27 28行內容刪除掉
#  32 subnet 172.25.254.0 netmask 255.255.255.0 {   ##修改網段和子網掩碼
#  33   range 172.25.254.110 172.25.254.120;        ##修改獲取到的動態地址
#  34   option routers 172.25.254.117;          ##
#  35 }
35行之後全部刪除
systemctl start dhcpd
systemctl status dhcpd
dhcpd.service - DHCPv4 Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; disabled)
   Active: active (running) since Thu 2017-11-02 11:34:44 CST; 3s ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
 Main PID: 3024 (dhcpd)

測試:用一臺新的虛擬機配置好網卡部分爲dhcp,然後去連接服務,ifconfig可以看到分配好的ip地址

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章