用户、组管理、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

相关推荐

  • sed练习题答案

    答案不唯一有更好答案请留言

    2018-04-13
  • LINUX防火墙

    防火墙的分类 systemctl stop firewalld.service :service iptables stop 关闭本机的防火墙并不意味者将防火墙禁用了,只是禁用系统默认的防火墙设置,自己可以再重新配置防火墙策略。   主机防火墙:服务范围为当前主机 网络防火墙:服务范围为防火墙一侧的局域网 硬件防火墙:在专用硬件级别实现部分功能的防…

    Linux笔记 2018-06-28
  • liunx基础

    在shell中可执行的命令有两类: 执行外部命令hash 缓存表   hash 常见用法 :

    Linux笔记 2018-04-01
  • 第11周

    总结

    Linux笔记 2018-06-10
  • Linux安全和加解密(三)

    本文主要介绍:1、ssh服务 2、基于SSH的客户端相关工具 3、SSH端口转发 4、dropbear编译安装 5、AIDE 6、sudo

    2018-05-30
  • Linux系统报错修复的方法 . 2

    /boot/vmlinuz-2.6.32-696.el6.x86_64.img文件丢失怎么办
    内有centos6的启动流程

    2018-05-12