第3周

时间:2021-09-06 05:08:35   收藏:0   阅读:16
[user1@CentOS test]$ grep -v  ‘\(.*/sbin/nologin$\)$‘ /etc/passwd|cut -d: -f1
root
sync
shutdown
halt
mageia
user1
user2
user3
[user1@CentOS test]$ grep -v  ‘\(.*/sbin/nologin$\)$‘ /etc/passwd|cut -d: -f1|wc -l
8
[user1@CentOS test]$ cat /etc/passwd|cut -d: -f1,3,7|sort -t: -k2 -nr |head -1
nobody:65534:/sbin/nologin
[root@CentOS ~]# ss -nt|tail -n +2|grep -Eo ‘([0-9]{1,3}\.){3}[0-9]{1,3}:[0-9]+[[:space:]]+$‘|grep -Eo ‘([0-9]{1,3}\.){3}[0-9]{1,3}‘|sort -n| uniq -c|sort -nr
[root@centos7-1-160 ~]# bash systeminfo.sh 
HOSTNAME: centos7-1-160
IPADDR: 10.0.0.164
VERSION: 7
KERNEL: 3.10.0-1127.el7.x86_64
CPU: Intel(R)Core(TM)i7-8750HCPU@2.20GHz
MEMORY: 972M
DISK: 150G
[root@centos7-1-160 ~]# cat systeminfo.sh 
#/bin/bash
echo  HOSTNAME:	`hostname`
echo  IPADDR:	`ifconfig | grep ‘^[[:space:]]\+inet.*[0-9]\+$‘|tr -s ‘ ‘ ! |cut -d! -f3|head -n 1`
echo  VERSION:	`cat /etc/os-release | grep ‘^VERSION=‘| grep -o ‘[0-9]\+‘`
echo  KERNEL:	`uname -r`
echo  CPU:	`lscpu | grep ‘^Model name‘|tr -d ‘ ‘|cut -d : -f2`
echo  MEMORY:	`free -h| grep ‘^Mem:‘|tr -s ‘ ‘ |cut -d ‘ ‘ -f2`
echo  DISK:	`lsblk | grep ‘^sd‘|tr -s ‘ ‘ %|cut -d% -f4|grep -o ‘[0-9]\+‘|paste -s -d+ |bc`G

原文:https://www.cnblogs.com/YANGLYANG/p/15203787.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!