学习总结第三期
1.定义一个对所有用户都生效的命令别名,例如:lftps=' lftp 172.168.0.1/pub'
编辑/etc/bashrc文件,在末行添加alias lftps=‘lftp 172.16.0.1/pub’
alias lftps='lftp 172.16.0.1/pub'
2.显示/etc/passwd文件中不以/bin/bash结尾的行
grep -v "/bin/bash$" /etcpasswd
3.找出/etc/passwd文件中,包含二位数字或者三位数的行
grep "\<[0-9]\{2,3\}\>" /etc/passwd
4.显示/proc/meminfo文件中以大写或者小写S开头的行;用三种方式实现
grep -i ^s /proc/meminfo
grep ^[Ss] /proc/meminfo
grep -E "^(s|S)" /proc/meminfo
5.使用echo输出一个绝对路径,使用egrep取出路径名,类型执行dirname/etc/passwd的结果
echo /etc/passwd | egrep -o '^/.+/'
6.找出ifconfig中的ip地址,要求结果只显示IP地址
ifconfig | grep "inet" |grep -v "inet6"|awk -F ' ' '{print $2}'
7.vim定制自动缩进四个字符
set shiftwidth=4
set tabstop=4
set ai
8.编写脚本,实现自动添加3个用户,并计算这3个用户的uid之和
9.find用法以及常用用法的实例演示
语法:find [OPTIONS] [查找起始路径] [查找条件] [处理动作]
实例:find . -type f -name "*.log" -print0 | xargs -0 rm -f