标签:自动 存在 echo toc pass time normal 文件中 expand
1、统计出/etc/passwd文件中其默认shell为非/s bin/nologin的用户个数,并将用户都显示出来[root@centos7 ~]# grep -v "/sbin/nologin" /etc/passwd |cut -d: -f1
root
sync
shutdown
halt
zjw
mageia
slackware
[root@centos7 ~]# getent passwd `cat /etc/passwd | cut -d: -f3 |sort -nr |head -n1`
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
[root@centos7 ~]# netstat -nt |tr -s " " : |cut -d: -f6 |sort |uniq -c|sort -nr|grep -vE "Foreign"
6 10.0.0.1
1 10.0.0.5
1 10.0.0.4
1
#!/bin/bash
#
#********************************************************************
#Author: zhangjiwei
#QQ: 1040204242
#Date: 2020-07-05
#FileName: createuser.sh
#URL: https://blog.51cto.com/12514160
#Description: The test script
#Copyright (C): 2020 All rights reserved
#********************************************************************
#自动添加用户
useradd $1 &>/dev/null
if [ $? -ne 0 ];then
echo -e "\033[33m 用户$1已经存在\e[0m"
else
echo -e "\033[33m 用户$1创建成功\e[0m"
echo -e "$1的UID:\033[33m`getent passwd 55kai |cut -d: -f3`\e[0m"
echo -e "$1的GID:\033[33m`getent passwd 55kai |cut -d: -f4`\e[0m"
echo -e "$1的SELL:\033[33m`getent passwd 55kai |cut -d: -f7`\e[0m"
fi
#vim .vimrc
set ai
set nu
set cul
set tabstop=4
autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == ‘sh‘
call setline(1,"#!/bin/bash")
call setline(2,"#")
call setline(3,"#********************************************************************")
call setline(4,"#Author: zhangjiwei")
call setline(5,"#QQ: 1040204242")
call setline(6,"#Date: ".strftime("%Y-%m-%d"))
call setline(7,"#FileName: ".expand("%"))
call setline(8,"#URL: https://blog.51cto.com/12514160")
call setline(9,"#Description: The test script")
call setline(10,"#Copyright (C): ".strftime("%Y")." All rights reserved")
call setline(11,"#********************************************************************")
call setline(12,"")
endif
endfunc
autocmd BufNewFile * normal G
标签:自动 存在 echo toc pass time normal 文件中 expand
原文地址:https://blog.51cto.com/12514160/2508780