脚本
K-zilizili
兴趣使然IT小白
展开
-
SELinux及网络监控
1、编写脚本selinux.sh,实现开启或禁用SELinux功能#!/bin/bash#The script boots selinux.status=$(getenforce) &> /dev/nullif [[ $status == Disabled ]];thensed -i "s@^\(\<SELINUX\>\)=[a-z]\+@\1=enforcing\$@g" /etc/selinux/config #启用selinuxfiif...原创 2020-08-16 12:19:05 · 229 阅读 · 0 评论 -
系统启动、登录及密码破解
1、编写脚本,接受二个位置参数,magedu和/www,判断系统是否有magedu,如果没有则自动创建magedu用户,并自动设置家目录为/www#!/bin/bash#Adding use.if [ $# -eq 0 ];thenecho "Error:enter username and setup basic directory!"exit 1fiid $1 &> /dev/nullif [ $? -eq 0 ];then...原创 2020-08-10 13:45:49 · 476 阅读 · 0 评论 -
进程管理与脚本练习
1、显示统计占用系统内存最多的进程,并排序。[root@wjl ~]# ps aux | sort -k4nr #对占用系统内存的所有进程排序root 2419 16.7 23.2 1930212 434740 ? Sl 16:50 37:30 /usr/bin/gnome-shellroot 1244 2.1 2.2 227872 42564 tty1 Ssl+ 16:50 4:53 /usr/bin/Xorg :0 -background原创 2020-08-02 21:01:00 · 150 阅读 · 0 评论 -
文本内容筛选及脚本练习
1、统计出/etc/passwd文件中其默认shell为非/sbin/nologin的用户个数,并将用户都显示出来。[root@wjl ~]# cat -n /etc/passwd | grep -v “/sbin/nologin” | cut -d ‘:’ -f ‘1’ | wc -l9[root@wjl ~]# cat -n /etc/passwd | grep -v “/sbin/nologin” | cut -d ‘:’ -f ‘1’rootsyncshutdownhaltlin原创 2020-07-06 09:31:24 · 530 阅读 · 0 评论