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

相关推荐

  • centos6启动流程

    不知道为什么编辑了前两次都发不了,这是第三次了

    Linux笔记 2018-05-13
  • Linux的学习之旅

    Linux的文件系统层级结构标准FHS image.png /etc=====和主机相关的系统配置文件 edit the configure /home===== 用户家目录 /usr======二层分层的目录。默认是最大的。 /dev=====设备文件 /media======挂载点和可移动的设备, /mnt=====临时挂载点 /var=======可变…

    Linux笔记 2018-04-01
  • Linux-用户、组和权限

    本章内容 解释Linux的安全模型 解释用户帐号和组群帐号的目的 用户和组管理命令 理解并设置文件权限 默认权限 特殊权限 ACL   安全3A 资源分派: Authentication:认证 Authorization:授权 Accouting|Audition:审计   用户user 令牌token,identity Linux用户:…

    2018-04-05
  • 一键编译安装apche脚本—适用于Centos6 和 Centos 7

    此脚本可实现apache,httpd-2.2.34适用于Centos6,和 httpd-2.4.25适用于Centos7,的一键编译安装。
    同时可实现在Centos6 和Centos7 上实现网络远程安装!

    2018-04-23
  • 正则表达式用户管理

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 [root@localhost ~]# cp -r /etc/skel /home/tuser1 [root@localhost ~]# chmod 700 /home/tuser1 -R [root@localhost ~…

    2018-06-04
  • 在linux服务器上运行django项目

    在linux服务器上运行django项目(1)需进入已创建的虚拟环境中。 (2)在虚拟环境中进入需要运行django项目(需进入到含有apps等文件的文件夹)                                                   进入哪个虚拟环境就是用哪个虚拟环境。 (3)MAKEMIGRATIONS:命令 python man…

    Linux笔记 2018-05-01