[root@ct7 ~]# grep -vc "/sbin/nologin" /etc/passwd
[root@ct7 ~]# grep -v "/sbin/nologin" /etc/passwd | cut -d: -f 1
[root@ct7 ~]# cat /etc/passwd | sort -t: -k3 -n | tail -1 | cut -d: -f1,3,7
[root@ct7 ~]# w -h | tr -s " "| cut -d " " -f3 | sort | uniq -c | sort -nr
点击查看代码
#!/bin/bash
#显示当前硬盘分区中空间利用率最大的值
max_disk=df -h | tr -s " " | cut -d " " -f5 | sort -nr | head -1
echo "当前硬盘分区中空间利用率最大的值: ${max_disk}"
编写脚本 systeminfo.sh,显示当前主机系统信息,包括:主机名,IPv4地址,操作系统版本,内核版本,CPU型号,内存大小,硬盘大小 点击查看代码
#!/bin/bash
编写脚本 systeminfo.sh,显示当前主机系统信息,包括:主机名,IPv4地址,操作系统版本,内核版本,CPU型号,内存大小,硬盘大小
echo "主机名: hostname
"
echo "IPv4地址:ip addr show eth0 | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -1
"
echo "系统版本:cat /etc/centos-release
"
echo "内核版本:uname -r
"
echo "CPU型号: lscpu | grep -i "model name" | cut -d: -f2 | tr -s " "
"
echo "内存大小:free -h | grep Mem | tr -s " " ":" | cut -d: -f2
"
echo "硬盘大小:lsblk | grep 'sda\>' | tr -s " " | cut -d " " -f4
"
6、20分钟内通关vimtutor(可参考https://yyqing.me/post/2017/2017-02-22-vimtutor-chinese-summary)
Original: https://www.cnblogs.com/anxuange/p/15718471.html
Author: 安玄歌
Title: Linux基础学习(三)
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/585190/
转载文章受原作者版权保护。转载请注明原作者出处!