第一题
创建根目录结构中的所有的普通文件
[root@localhost ~]# cd /[root@localhost /]# mkdir /text[root@localhost /]# cd /text[root@localhost text]# mkdir /text/boot /text/root /text/home /text/bin /text/sbin /text/lib /text/lib64 /text/usr /text/opt /text/etc /text/tmp /text/run /text/dev /text/mnt /text/media /text/var /text/srv /text/sys /text/proc[root@localhost var]# mkdir /text/var/log /text/var/spool[root@localhost var]# cd /text/var/log[root@localhost log]# mkdir /text/var/log/messages /text/var/log/secure /text/var/log/cron [root@localhost log]# cd ..[root@localhost var]# cd /text/var/spool[root@localhost spool]# mkdir /text/var/spool/mail /text/var/spool/cron[root@localhost spool]# cd ..[root@localhost var]# cd ..[root@localhost text]# cd /text/etc[root@localhost etc]# mkdir /text/etc/hostmane /text/etc/hosts /text/etc/fstab /text/etc/bashrc /text/etc/chrony.conf /text/etc/ssh /text/etc/passwd /text/etc/shadow /text/etc/sudoers /text/etc/group[root@localhost etc]# cd /text/etc/ssh[root@localhost ssh]# mkdir /text/etc/ssh/ssh_config /text/etc/ssh/sshd_config /text/etc/ssh/sshd_config.d[root@localhost ssh]# cd ..[root@localhost etc]# cd ..[root@localhost text]# tree

第二题
列出所有账号的账号名
[root@jky ~]# cut -d ":" /etc/passwd -f1 rootbindaemonadmlpsyncshutdownhaltmailoperatorgamesftpnobodytsssystemd-coredumpdbuspolkitdavahicolordrtkitpipewireclevissssdgeoclueflatpaksetroubleshootlibstoragemgmtsystemd-oomgdmcockpit-wscockpit-wsinstancegnome-initial-setupsshdchronydnsmasqtcpdumpredhatxiaohongxiaomingnginx
第三题
将/etc/passwd中内容按照冒号隔开的第三个字符从大到小排序后输出所有内容
[root@jky ~]# cut -d ":" -f3 /etc/passwd | sort -nr65534203020292028202720262025202210041003100210011000999998997996995994993992991985984983982981980979978172817472705942141211876543210
第四题
列出/etc/passwd中的第20行-25行内容
[root@jky ~]# head -25 /etc/passwd | tail -6rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologinpipewire:x:996:992:PipeWire System Daemon:/var/run/pipewire:/sbin/nologinclevis:x:995:991:Clevis Decryption Framework unprivileged user:/var/cache/clevis:/usr/sbin/nologinsssd:x:994:990:User for sssd:/:/sbin/nologingeoclue:x:993:989:User for geoclue:/var/lib/geoclue:/sbin/nologinflatpak:x:992:988:User for flatpak system helper:/:/sbin/nologin
第五题
切割出你的ip地址和mac地址
# 切割出来IP地址[root@jky ~]# ip a | grep ens160 2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000inet 192.168.247.128/24 brd 192.168.247.255 scope global dynamic noprefixroute ens160[root@jky ~]# ip a | grep ens160 | grep inet | cut -d "/" -f1 inet 192.168.247.128# 切割出来MAC地址(1)环回的MAC地址[root@jky ~]# ip a | grep lo 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host loinet 192.168.247.128/24 brd 192.168.247.255 scope global dynamic noprefixroute ens160[root@jky ~]# ip a | grep lo | grep linklink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00[root@jky ~]# ip a | grep lo | grep link | cut -d " " -f600:00:00:00:00:00(2)以太网接口 ens160 的 MAC 地址[root@jky ~]# ip a | grep link/etherlink/ether 00:0c:29:f5:84:74 brd ff:ff:ff:ff:ff:ff[root@jky ~]# ip a | grep link/ether | cut -d " " -f600:0c:29:f5:84:74
第六题
切割出/etc/passwd中的最后一个字段并进行重复内容的重复次数统计
[root@jky ~]# cut -d ":" -f7 /etc/passwd | sort[root@jky ~]# cut -d ":" -f7 /etc/passwd | sort | uniq -c13 /bin/bash1 /bin/sync1 /sbin/halt28 /sbin/nologin1 /sbin/shutdown5 /usr/sbin/nologin[root@jky ~]# cut -d ":" -f7 /etc/passwd | sort | uniq -c