用户、组管理、grep、重定向及文本处理习题

用户、组管理、grep、重定向及文本处理习题

1

1.w | cut -d’ ‘ -f1 | uniq

2.grep -E “($(w | cut -d’ ‘ -f1 | tail -1))” /etc/passwd

3.cut -d’:’ -f7 /etc/passwd | uniq -c | sort -n | tail -1

4.grep -E “$(cut -d’:’ -f3 /etc/passwd | sort -n | tail -10)” /etc/passwd > /tmp/test1

tr [a-z] [A-Z] < /tmp/test1

5.ifconfig | grep inet | cut -d’:’ -f2 | cut -d ‘ ‘ -f1 | head -1

6./etc/ | grep -E ‘.*.conf\>$’ | tr [a-z] [A-Z] > /tmp/etc.conf

7.ls /var | wc -w

8.sort -t’:’ -k3 -n /etc/group | tail -10 | cut -d’:’ -f1

9.cat /etc/issue /etc/fstab > /tmp/etc.test

10.[root@localhost ~]# groupadd -g 2016 distro
[root@localhost ~]# useradd -u 1005 -g distro mandriva
[root@localhost ~]# useradd -u 1100 -d /home/linux mageia
[root@localhost ~]# echo ‘magedu’ | passwd –stdin mageia
[root@localhost ~]# userdel mandriva
[root@localhost ~]# groupadd peguin
[root@localhost ~]# useradd -u 2002 -g distro -G peguin slackware
[root@localhost ~]# usermod -s /bin/tcsh slackware
[root@localhost ~]# groupadd admins
[root@localhost ~]# usermod -a -G admins slackware

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/100860

(0)
radixradix
上一篇 2018-06-11 20:31
下一篇 2018-06-11 21:14

相关推荐

  • Work Tow

    1、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。 linux上一切皆文件 (1)文件管理命令:cat、tac、head、tail、more、less等 cat:查看文件内容,一次性输出所有内容 ​                  -n :输出所有行编号 ​                  -b 对非空输出行号 例如:cat /…

    2018-07-15
  • 正则表达式

    基本正则表达式元字符

    Linux笔记 2018-06-22
  • RAID和逻辑卷

    1、RAID技术
    2、RAID实验
    3、逻辑卷管理
    4、逻辑卷快照

    Linux笔记 2018-06-10
  • linux网络基础

    无线网络标准: 中国:早期wapi后期wapi+wifi 国际:wifi 无线模式802.11 a/b/n/ac/bn,以太模式IEEE  802.3 网络施工模式: ethtool eth0 单工:单向传输 双工:双向传输 全双工:同时双向 半双工:轮流双向 集线器Hub :由于网线信号电流强度受距离影响,所以集线器很好的提供了电能 冲突域:同个网域中发送…

    Linux笔记 2018-05-07
  • linux魔鬼训练营初体验

    听话照做

    2018-04-01