你的位置:首页 > 软件开发 > 操作系统 > linux基础:第三关课前考试题整理

linux基础:第三关课前考试题整理

发布时间:2015-12-24 17:00:16
[root@server ~]# stat /etc/hosts File: "/etc/hosts" Size: 178 Blocks: 8 IO Block: 4096 普通文件 Device: 803h/2051d Inode: 130078 Links ...

[root@server ~]# stat /etc/hosts File: "/etc/hosts" Size: 178 Blocks: 8 IO Block: 4096 普通文件 Device: 803h/2051d Inode: 130078 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2015-12-24 15:50:01.351799952 +0800 Modify: 2015-12-02 21:43:38.484600576 +0800 Change: 2015-12-02 21:43:38.484600576 +0800 #方法1:后向引用 [root@server ~]# stat /etc/hosts|sed -nr '4s#^.*\(0(.*)/-.*$#\1#gp' 644 #方法2:awk多分隔符取列 [root@server ~]# stat /etc/hosts|sed -n '4p'|awk -F '[0/]' ' {print $2}' 644 #方法3:awk多分隔符取列 [root@server ~]# stat /etc/hosts|awk -F '[0/]' 'NR==4 {print $2}' 644 #方法4:命令直接取 [root@server ~]# stat -c %a /etc/hosts #%a表示访问权限八进制 644 [root@server ~]# #方法5:扩展如何将ls -l命令中的权限字符转换为八进制数字? [root@server ~]# ll /etc/hosts|cut -c 2-10|tr "rwx-" "4210"|awk -F "" '{print $1+$2+$3 $4+$5+$6 $7+$8+$9}' 644 #知识点:1.tr字符替换的使用;2.cut -c截取字符;3.awk指定分隔符为空。


 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:linux基础:第三关课前考试题整理

关键词:linux

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录