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地址

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