用户、组管理、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运维部落立场,如若转载,请注明出处:https://www.178linux.com/100860

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

相关推荐

  • Linux中的练习题

    Linux文本查看和处理练习题
    Linux用户和组管理类命令的使用方法及练习题

    Linux笔记 2018-07-08
  • Linux

    Linux 系统启动过程和Linux系统目录介绍

    Linux笔记 2018-04-05
  • docker学习记录系列(一)

    虚拟化与容器

    Linux笔记 2018-06-02
  • Linux运维命令以及概念整理总结(1)

    1、文件系统分层结构: LBS Linux Standard Base
    2、ls命令、wc命令、时间戳、stat、通配符glob
    3、touch、cp、mv、rm、批量改名rename
    4、tree、mkdir、rmdir
    5、节点编号inode以及节点表、硬链接以及软链接
    6、file命令、标准输入,标准输出

    2018-04-14
  • 运维之pxe、dhcp、cobbler

    运维之pxe、dhcp、cobbler 把一个主机接入TCP/IP网络,要配置哪些网络参数:ip/mask、gateway、dns server;参数配置方式:1、静态配置;2、动态分配:a、bootp协议b、dhcp协议:引入了“租约”的bootp; DHCP:动态主机配置协议:arp:address resolving protocol:地址解析协议:I…

    Linux笔记 2018-07-22
  • Linux运维初步—第三周

    Linux运维初步—第三周总结与练习 标签(空格分隔): linux入门 linux 运维 — 写作:N27_loong 2017-7-27[TOC] 一、本周主要内容回顾: 用户(组)管理: – 增加用户或组,指定用户权限、家目录路径、用户属组属主的变更; – 用户密码和组密码加密和验证的设计和文件存储位置;…

    Linux笔记 2018-07-27