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

相关推荐

  • centos7 修改密码

    修改密码

    Linux笔记 2018-05-15
  • shell脚本

    编程基础: 程序:指令+数据 程序编程风格; 面向过程:以指令为中心,数据服务于指令 面对对象:以数据为中心,指令服务于数据 高级: 编译:高级语言—>编译器—>目标代码 Java、C# 解释:高级语言—>解释器—>机器代码 shell、Perl、Python 编程逻辑处理方式: 顺序执…

    2018-04-11
  • Linux基础知识

    一:用户登录 root用户:管理员账户,也被称为超级用户,root拥有对Linux系统的所有权限,甚至可以把自己杀死(rm -rf /*),除非必须,一般不用root用户登录系统 普通用户:权限受到限制,只可以对自己有权限的文件进行操作 二:终端(terminal) 1.设备终端 键盘鼠标显示器 2.物理终端( /dev/console ) 控制台conso…

    2018-03-29
  • linux系统修复报错的方法 . 3

    stage1如果丢失怎么办
    stage1.5如果丢失怎么办
    后有centos6的启动流程

    2018-05-12
  • liunx基础命令

    alias:查看命令别名(别名只针对用户有效) alias h=hostname(定义别名) cdnet=‘cd /etc/sysconfig/network-scripts/’(带参数命令的要带单引号) 想长久生效修改.bashrc文件(root为/root/.bashrc,全部用户为/etc/bashrc,其他/home/user/.bashrc) un…

    Linux笔记 2018-04-08
  • DNS服务

    DNS

    2018-07-19