-v :反向選擇,亦即顯示出沒有 ’搜尋字串 ’ 內容的那一行!
grep -n ’the ’ 123.txt 搜索the字符 -----------搜尋特定字串
grep -n ’t[ea]st ’ 123.txt 搜索test或taste两个字符---------利用 [] 來搜尋集合字元
grep -n ’[^g]oo ’ 123.txt 搜索前面不为g的oo-----------向選擇 [^]
grep -n ’[0-9] ’ 123.txt 搜索有0-9的数字
grep -n ’^the ’ 123.txt 搜索以the为行首-----------行首搜索^
grep -n ’^[^a-zA-Z] ’ 123.txt 搜索不以英文字母开头
grep -n ’[a-z]$ ’ 123.txt 搜索以a-z结尾的行---------- 行尾搜索$
grep -n ’g..d ’ 123.txt 搜索开头g结尾d字符----------任意一個字元 .
grep -n ’ooo* ’ 123.txt 搜索至少有两个oo的字符---------重複字元 *
sed 文本流编辑器 利用脚本命令来处理文本文档
awd 模式扫描和处理语言
nl 123.txt | sed ’2,5d ’ 删除第二到第五行的内容
diff 比较文档的差异
cmp 比较两个文档是否有差异
patch 修补文档
pr 要打印的文档格式化
帐号管理
/etc/passwd 系统帐号信息
/etc/shadow 帐号密码信息 经MD5 32位加密
在密码栏前面加『 * 』『 ! 』禁止使用某帐号
/etc/group 系统群组信息
/etc/gshadow
newgrp 改变登陆组
useradd & adduser 建立新用户 ---------〉 useradd -m test 自动建立用户的登入目录
useradd -m -g pgroup test ---------〉 指定所属级
/etc/default/useradd 相关设定
/etc/login.defs UID/GID 有關的設定
passwd 更改密码 -----------〉 passwd test
usermod 修改用户帐号
userdel 删除帐号 -----------〉 userdel -r test
chsh 更换登陆系统时使用的SHELL [-l]显示可用的SHELL;[-s]修改自己的SHELL
chfn 改变finger指令显示的信息
finger 查找并显示用户信息
id 显示用户的ID -----------〉 id test
groupadd 添加组
groupmod 和usermod类似
groupdel 删除组
su test 更改用户 su - 进入root,且使用root的环境变量
sudo 以其他身份来执行指令
visudo 编辑/etc/sudoers 加入一行『 test ALL=(ALL) ALL 』
%wheel ALL = (ALL) ALL 系统里任何wheel群组的用户都可用sudo
%wheel ALL = (ALL) NOPASSWD: ALL wheel群组任何用户都不用密码NOPASSWD
User_Alias ADMPW = vbird, dmtsai, vbird1, vbird3 加入ADMPW组
ADMPW ALL = NOPASSWD: !/usr/bin/passwd, /usr/bin/passwd [A-Za-z]*, \
!/usr/bin/passwd root 能够更改使用者密码,但不能更改root密码 (在指令前面加入 ! 代表不可)
PAM (Pluggable Authentication Modules, 嵌入式模組)
who & w 看谁在线
last 最近登陆主机的信息
lastlog 最近登入的時間 读取 /var/log/lastlog
talk 和其他用户交谈
write 发送信息 write test [ctrl] d 发送
mesg 配置终端机的写入权限 mesg n 禁止接收 mesg y
wall 向任何用户发送信息 wall this is q test
mail 写mail
/etc/default/useradd 家目录默认配置
quota 显示磁盘已使用的空间和限制 quota -guvs -----〉 秀出现在 root 自己的 quota 限制值
quota -vu 查询
quotacheck 检查磁盘的使用空间和限制 quotacheck -avug -----〉 將任何的在 /etc/mtab 內,含有 quota 支援的 partition 進行掃瞄
[-m] 强制扫描
quota一定要是单独的分区,要有quota.user和quota.group两件文档,在/etc/fstab添加一句:
/dev/hda3 /home ext3 defaults,usrquota,grpquota 1 2
chmod 600 quota* 配置完成,重启生效
edquota 编辑用户或群组的quota 用户,[g]群组,[p]复制,[t]配置宽限期限
edquota -a yang edquota -p yang -u young -----〉 复制
quotaon 开启磁盘空间限制 quotaon -auvg --------〉 啟動任何的具备 quota 的 filesystem
quotaoff 关闭磁盘空间限制 quotaoff -a --------〉 關閉了 quota 的限制
repquota -av 查閱系統內任何的具备 quota 的 filesystem 的限值狀態
Quota 從開始準備 filesystem 的支援到整個設定結束的主要的步驟大概是:
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!



