N27_第五周作业

一、显示当前系统上root、fedora或者user1用户的默认shell;

[root@localhost ~]# grep -E “^(root|fedora|user1)” /etc/passwd | cut -d: -f7

/bin/bash

/bin/tcsh

/bin/bash
二、找出/etc/rc.d/init.d/functions文件中某单词后面跟一小组括号的行,刑如:hello()

[root@localhost ~]# cat /etc/rc.d/init.d/functions | grep -o -E “\\(\)”

checkpid() {

daemon() {

killproc() {

pidfileofproc() {
三、使用echo命令输出一个绝对路径,使用grep取出基名

[root@localhost ~]# echo “/etc/tmp/test/” | grep -o -E “[^/]+/?$” | cut -d/ -f1

test
四、找出ifconfig命令结果中的1-255之间的数字;

[root@localhost ~]# ifconfig | grep -o -E “\”

29

31

192

168

106

1

五、查找/var目录下属主为root,且属组为mail的所有文件或者目录;

root@localhost ~]# find /var -user root -a -group mail

/var/spool/mail

/var/test1

/var/test
六、查找当前系统上没有属主或者属组的文件;进一步:查找当前系统上没有属主或属组,且最近3天内曾被被访问过的文件或者目录。

[root@localhost ~]# find / \( -nouser -o -nogroup \) -a -atime -3
七、查找/etc目录下所有用户都有写权限的文件;

[root@localhost ~]# find /etc -perm +222

八、查找/etc目录下大于1M,且类型为普通文件的所有文件。

[root@localhost ~]# find /etc -size +1M -a -type f

/etc/gconf/gconf.xml.defaults/%gconf-tree.xml

/etc/selinux/targeted/modules/active/policy.kern

/etc/selinux/targeted/policy/policy.24

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/87970

(1)
N27_Sunny dayN27_Sunny day
上一篇 2017-10-18 11:40
下一篇 2017-10-21 10:27

相关推荐

  • 马哥教育网络班21期+第13周课程练习

    1、建立samba共享,共享目录为/data,要求:(描述完整的过程) 1)共享名为shared,工作组为magedu; 2)添加组develop,添加用户gentoo,centos和ubuntu,其中gentoo和centos以develop为附加组,ubuntu不属于develop组;密码均为用户名; 3)添加samba用户gentoo,centos和u…

    Linux干货 2016-10-17
  • 网络管理之网络配置

    一:博客 1 centos6网卡别名 在Linux系统中,我们可以在一块物理网卡上配置多个IP地址,以此来实现类似子接口的功能,我们称之为网卡别名。 设置网卡别名,先在/etc/sysconfig/network-scripts目录下将eth0文件复制名为eth0:1的文件,复制文件中的1可随意设置,但为方便管理建议按顺序排列 注意要修改ifcfg-eth0…

    Linux干货 2016-09-05
  • 文本处理及正则表达式

    文本处理工具:     more:分页查看文件     less:分页控制显示文件     head 查看文件的前几行         -n 3   显示前三行      &nbs…

    Linux干货 2017-05-31
  • awk 的相关知识

    awk 介绍,基本用法,变量,格式化,操作符,条件判断,循环,数组,函数等

    2018-01-01
  • N26-第四周

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。   2.编辑/etc/group文件,添加组hadoop。          3.手动编辑/etc/passwd文件新增一行,添加用户hadoop,其基本组ID为h…

    2017-02-22
  • nginx相关配置及解释

    全局配置: user  nginx nginx; #运行程序的用户和用户组pid      /var/run/nginx.pid; #主控进程load_module /usr/lib64/nginx/modules/ngx_http_geoip_module.so;#加载模块 work进程的数量:通常为当前主…

    Linux干货 2017-05-07