马哥教育作业第四周

1.systeminfo.sh
#!/bin/bash
echo "HOSTNAME is $(hostname)"

echo "IPADDRESS is "
ip a | egrep "^[[:digit:]]|inet"

echo "OS is $(cat /etc/redhat-release)"

echo "KERNEL is $(uname -r)"

echo "CPU model is $(lscpu | head -13 | tail -1)"

echo "MEM is "
free

echo "HARD DISK SIZE is"
df
chmod +x systeminfo.sh

2.back.sh
#!/bin/bash
cp -a /etc /root/etc$(date +%F)
chmod +x back.sh
将该脚本放在/etc/cron.daily

3.disk.sh
#!/bin/bash
df | awk '{print $5}' | sort -n | tail -1

4.links.sh
ss -nt | awk '{print $5}' | sort -nr | uniq -c

5.sed 'a\ ' test.txt

6.sed -n '1~2p' /etc/passwd


猜你喜欢

转载自www.cnblogs.com/jinlei92131/p/12931113.html