一、用户添加 1. 账号添加 这时/etc/passwd文件中会追加该用户项,并且在/home文件夹下自动生成该属于该用户的文件夹,默认用户组为该用户名 2. 密码设置 3. 用户组添加 4. 已有的用户,将其用户组改为Learn 5. 新建用户时同时设置其用户组 6. 关闭用户账号(暂停使用,注意 ...
分类:
系统相关 时间:
2016-09-07 10:39:27
阅读次数:
206
1、显示当前系统上root、fedora或user1用户的默认shell;#grep:-E:使用扩展正则表达式,即egrep,^:行首匹配,|:或者
#cut:-d:指定分隔符,-f:取第几列
[root@localhostshell]#grep-E"^root|fedora|user1"/etc/passwd|cut-d:-f1,7
root:/bin/bash2、找出/etc/rc.d/init.d..
分类:
其他好文 时间:
2016-09-06 23:38:24
阅读次数:
266
1、显示当前系统上root、fedora或user1用户的默认shell;egrep"^(root|fedora|user1)\>"/etc/passwd|cut-d:-f1,7root|fedora|user1表示三者符合其一的选择条件()使其归组^表示以后面归组的条件开头\>表示以空字符截断此前的条件字符,即后跟其它字符的单词将不匹配2、..
分类:
系统相关 时间:
2016-09-06 23:37:39
阅读次数:
311
1、显示当前系统上root、fedora或user1用户的默认shell;grep-E"^root\>|^fedora\>|^user1\>"/etc/passwd|cut-d:-f1,72、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();grep-o"[[:alpha:]]\+()"/etc/rc.d/init.d/functions3、使用..
分类:
系统相关 时间:
2016-09-06 23:32:34
阅读次数:
367
一、grep:文本搜索工具-c只输出匹配的行数-i不区分大小写-v过滤掉包含指定字符串的行-s不显示不存在或无匹配的文本的错误信息-w只显示匹配的整个单词,而不是字符串的一部分-n显示匹配行及行号-l只列出匹配的文件名-L列出不匹配的文件名例:grep-croot/etc/passwd如果包含root..
分类:
系统相关 时间:
2016-09-06 23:20:28
阅读次数:
338
用户uid:100以内为系统用户100-400为应用用户400以后为自己创建的用户【用户存在的系统文件】/etc/passwd//用户组信息文件/etc/group//用户组信息/etc/shadow//用户认证信息/home/username//用户家目录/etc/skel/.*//用户的基本配置信息#vim/etc/passwd//共7段用户名称:密码:..
分类:
其他好文 时间:
2016-09-06 01:35:39
阅读次数:
237
1、显示当前系统上root、fedora或user1用户的默认shell;[root@mageedu~]#useraddfedora
[root@mageedu~]#useradduser1
[root@mageedu~]#egrep"^(root|fedora|user1)"/etc/passwd|cut-d:-f1,7
root:/bin/bash
fedora:/bin/bash
user1:/bin/bas2、找出/etc/rc.d/init.d/function..
分类:
系统相关 时间:
2016-09-06 01:30:27
阅读次数:
300
1、显示当前系统上root、fedora或user1用户的默认shell;#/etc/passwd文件中每行第一字段为用户名,第七字段为默认bash,使用^进行行首锚定,然后使用egrep中的正则表达式元字符“|”来匹配,使用cut命令切割出第一和第七字段得到结果。
[root@localhost~]#egrep"^root|fedora|..
分类:
其他好文 时间:
2016-09-06 01:26:00
阅读次数:
167
本周作业内容:显示当前系统上root、fedora或user1用户的默认shell;#egrep"^(root|user1|fedora)"/etc/passwd|cut-d:-f72、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();#egrep"^[[:alpha:]]+\(\)"/etc/rc.d/init.d/functions3、使用echo..
分类:
其他好文 时间:
2016-09-06 01:22:12
阅读次数:
166
依次向/etc/passwd中的每个用户问好,并显示对方的shell#!/bin/bash
#
forIin`cut-d":"-f1/etc/passwd`;do
B=`grep"^$I\>"/etc/passwd|cut-d":"-f7`
echo"hello,$Iyourbashis$B"
done执行结果[root@localhost~]#bash./helloeveryone.sh
hello,rootyourbashis/bin/bash
hello..
分类:
其他好文 时间:
2016-09-06 01:13:05
阅读次数:
175