RHCSA的练习(2)
1.将3,4 字段分别截取出来分别写入文件UID和文件GIU但是这两个文件中的信息是以数值由大到小的形式显示
[root@localhost ~]# cat /etc/passwd | cut -d : -f 3 | sort -rn > UID
[root@localhost ~]# cat /etc/passwd | cut -d : -f 3 | sort -rn |tee UID
[root@localhost ~]# cut -d : -f 3 /etc/passwd | sort -rn |tee UID
[root@localhost ~]# cut -d : -f 3 /etc/passwd | sort -rn > UID
[root@localhost ~]# cat /etc/passwd | cut -d : -f 4 | sort -rn > GIU
2.通过查看时间命令将分别将时分写入A文件
[root@localhost ~]# date | cut -d " " -f 6 > A
[root@localhost ~]# date | cut -d " " -f 2,3,4 | cut -d : -f 1,2 >>A
[root@localhost ~]# cat A
2022
Nov 30 18:51
3.告诉用户当前系统有多少用户
[root@localhost ~]# echo 当前系统共有`wc -l /etc/passwd | cut -d " " -f 1`个用户
当前系统共有46个用户
4.不显示/etc/login.defs 文件中以#开头的行以及空白行
[root@localhost ~]#grep -Ev '^#|^$' /etc/login.defs
原文地址:https://blog.csdn.net/Starry__Sky222/article/details/142922180
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!