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

相关推荐

  • Blog Day 1:在Windows下搭建Linux学习环境

    By:Alvin Lin
    No:M30-43
    Date:2018-04-01

    -目录-
    第零部分:安装VMware Workstations 12 虚拟机软件程序(Windows平台)
    第一部分:创建虚拟机
    第二部分:安装CentOS6.9
    第三部分:安装CentOS7.4

    2018-04-01
  • chmod 大写X

    大写执行权限X,加了怎么不显示呢

    2018-04-09
  • VMware安装过程中出现的问题及解决方法

    VMware软件的安装应当是非常简单的,但在本次的安装过程中却出现了两个问题,其中第一个问题比较好解决,但是第二个问题却让我纠结和浪费了很多的时间。以下是对于两个问题的描述及解决方法,以备出现同样问题的人们参考:  问题1:已将该虚拟机配置为64位客户机操作系统,但是,无法执行64位操作.具体错误提示见图:  解决方法:重启计算机,启动过程中按F12键(或依…

    2018-03-29
  • 文件实时查找工具-find

    find:命令 实时查找工具,通过遍历指定路径完成文件查找 工作特点:查找速度慢,精确查找,实时查找,可能只搜索用户具备读取和执行的目录 用法:  find【OPTION]…[查找路径】【查找条件】【处理动作】 查找路径:指定具体目标路径;默认为当前目录查找条件:指定的查找标准,可以文件名、大小、类型、权限等标准进行;默认为找出指定路径下的所有文…

    2018-04-13
  • Apache

    apache的安装

    2018-04-22
  • 磁盘管理知识

    磁盘管理知识 1.tune2fs(调整文件系统参数)      [root@centos6 ~]#tune2fs -i 3 /dev/sdb (interval 间隔,即3天检查一次)      tune2fs 1.41.12 (17-May-2010)      Setting interval between checks to 259200 secon…

    Linux笔记 2018-04-24