First, find the line in the/etc/rc.d/init.d/functions file followed by a set of parentheses, such as: Hello ();
# Cat/etc/rc.d/init.d/functions | grep ' [[: alpha:]].* () '
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8D/D7/wKioL1isXg7xZfecAAC4ol6u5SI202.png-wh_500x0-wm_ 3-wmp_4-s_1631737818.png "title=" 1.png "alt=" Wkiol1isxg7xzfecaac4ol6u5si202.png-wh_50 "/>
Use the echo command to output an absolute path, use grep to remove its base name, and expand: Take out its path name;
# echo/etc/sysconfig/network-scripts |grep ' ^/[[:alpha:]]\+[^/] '
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8D/D7/wKioL1isXmOzjkG8AAAeuNPucUc601.png-wh_500x0-wm_ 3-wmp_4-s_264003832.png "title=" 2.png "alt=" Wkiol1isxmozjkg8aaaeunpucuc601.png-wh_50 "/>
# Echo/proc/meminfo | Grep-o ' \b/.* '
Third, find out the ifconfig command results in the number between 1-255;
# ifconfig| Grep-e ' \b ([0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) \b '
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/D9/wKiom1isXpDhmONvAACi4rXIW04836.png-wh_500x0-wm_ 3-wmp_4-s_4263455120.png "title=" 3.png "alt=" Wkiom1isxpdhmonvaaci4rxiw04836.png-wh_50 "/>
To find files that are not owned by the master or group on the current system;
# find/\ (-nouser-o-nogroup \)-ls
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/8D/D9/wKiom1isXq-w25V7AAC8e9yjiiw930.png-wh_500x0-wm_ 3-wmp_4-s_2362320307.png "title=" 4.png "alt=" Wkiom1isxq-w25v7aac8e9yjiiw930.png-wh_50 "/>
Find files or directories on the current system that are not owned by the master or group and have been visited in the last 3 days;
# Find/\ (-nouser-o-nogroup \)-a-atime-3-ls
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/8D/D9/wKiom1isXvXDhERnAABP2h31ZN0838.png-wh_500x0-wm_ 3-wmp_4-s_3605878400.png "title=" 4-2.png "alt=" Wkiom1isxvxdhernaabp2h31zn0838.png-wh_50 "/>
V. Find all files that are larger than 1M in the/etc directory and are of the normal file type;
# find/etc-type f-a-size +1m-ls |
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/8D/D7/wKioL1isXxLj7jW2AAA4vYLZPY4461.png-wh_500x0-wm_ 3-wmp_4-s_2278088846.png "title=" 5.png "alt=" Wkiol1isxxlj7jw2aaa4vylzpy4461.png-wh_50 "/>
Six, the search/ETC/INIT.D directory, all users have execute permissions, and other users have write permission files;
# find/etc/init.d-perm-113-ls
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/D7/wKioL1isXyvwMJlyAAAqcB2TTyY167.png-wh_500x0-wm_ 3-wmp_4-s_3452897349.png "title=" 6.png "alt=" Wkiol1isxyvwmjlyaaaqcb2ttyy167.png-wh_50 "/>
vii. Find files whose contents have been modified and are not root or Hadoop for the last week in/etc directory;
# find/etc-not \ (-user root-o-user hadoop\)-a-ctime-7-ls
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/8D/D9/wKiom1isX1iT4cVSAAAwXllZtEM671.png-wh_500x0-wm_ 3-wmp_4-s_3450234237.png "title=" 7.png "alt=" Wkiom1isx1it4cvsaaawxllztem671.png-wh_50 "/>
Copy the/etc/rc.d/rc.sysinit file to the/tmp directory and add # to the beginning of the line at least one whitespace character in the/tmp/rc.sysinit file;
copy files first
# cp/etc/rc.d/rc.sysinit/tmp
Then use the Vim editor, with the expression ":%s/^[[:space:]" in the last-line mode to replace the/#&/
# Vim/tmp/rc.sysinit
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/8D/D7/wKioL1isX33ARiIgAAAszCNr3M0829.png-wh_500x0-wm_ 3-wmp_4-s_1940743453.png "title=" 8-1.png "alt=" Wkiol1isx33ariigaaaszcnr3m0829.png-wh_50 "/>
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/D9/wKiom1isX6ChanyhAAD8q1I3oUc069.png-wh_500x0-wm_ 3-wmp_4-s_1596382629.png "title=" 8-2.png "alt=" Wkiom1isx6chanyhaad8q1i3ouc069.png-wh_50 "/>
Delete the # and white space characters in the/tmp/rc.sysinit file that begin with # and followed by at least one white-space character;
using the Vim editor, the last-line mode is replaced by the expression ":%s/^#[[:space:]]\ (. *\)/\1/"
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/8D/D7/wKioL1isX9fQO42SAAAuHJOQbsg876.png-wh_500x0-wm_ 3-wmp_4-s_1777446455.png "style=" Float:none; "title=" 9-1.png "alt=" Wkiol1isx9fqo42saaauhjoqbsg876.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/8D/D9/wKiom1isX9nCP1B6AADCxlpbOP4410.png-wh_500x0-wm_ 3-wmp_4-s_2427493438.png "style=" Float:none; "title=" 9-2.png "alt=" Wkiom1isx9ncp1b6aadcxlpbop4410.png-wh_50 "/>
Change the last 0 of all enabled=0 or gpgcheck=0 in the/etc/yum.repos.d/centos-media.repo file to 1;
Replace with expression "%s/\ (. *\) =0/\1=1/"
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8D/D7/wKioL1isYA2A_uOqAAAQwInKKao539.png-wh_500x0-wm_ 3-wmp_4-s_1387357739.png "style=" Float:none; "title=" 10-1.png "alt=" wkiol1isya2a_uoqaaaqwinkkao539.png-wh_50 "/ >
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/D9/wKiom1isYA7AsMh6AAChpu5gaSs793.png-wh_500x0-wm_ 3-wmp_4-s_852642396.png "style=" Float:none; "title=" 10-2.png "alt=" Wkiom1isya7asmh6aachpu5gass793.png-wh_50 "/>
Xi. Weekly 2,4,6 backup/var/log/messages file to/backup/messages_logs directory, the saved file name is like messages-20161202;
# crontab-e
0 2 * * 2,4,6 root tar-cjf/backup/messages_logs/messages-' Date +%y%m%d '. tar.xz/var/log/messges
12, every two hours every day to take the current system/proc/meminfo file all the information in the beginning of S to the/stats/memory.txt file;
# crontab-e
0 */2 * * * Root Cat/proc/meminfo | grep ' ^s ' >/stats/memory.txt
13, write a script to create user10-user19; password and user name;
# vim useradd.sh
#/bin/bash
# Test Add ten Users
#
Declare-i I
For i in {10..19}
Do
if (ID user$i &>/dev/null); Then
Echo ' the user$i exist. '
Else
Useradd user$i >/dev/null
echo ' user$i ' | passwd--stdin user$i>/dev/null
Echo ' Adduser finished. '
Fi
Done
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/8D/D9/wKiom1isYDfAUFA3AABQhqYTeog616.png-wh_500x0-wm_ 3-wmp_4-s_1824473640.png "title=" 13-1.png "alt=" Wkiom1isydfaufa3aabqhqyteog616.png-wh_50 "/>
This article is from the "Linux High-end training" blog, please be sure to keep this source http://hhclab.blog.51cto.com/6743827/1900048
The third operation of Linux operation and maintenance class