第2章shell及常用命令分析.ppt

第2章 Shell 及其常用命令 一、shell基础 文本文件的处理命令 more、cat、head、tail wc grep more:逐屏显示文件 使用方法 more server.c 指定一个文件 more *.[ch] 指定多个文件 more 满屏后,显示--more--或--more--(15%),可以使用more命令: cat:列出文件内容 举例 cat tryl.c head与tail head -15 ab.c 显示文件ab.c中前15行 tail -10 liu.mail wc:字计数(word count) 功能 列出文件中一共有多少行,有多少个单词,多少字符 常用选项-l:只列出行计数 举例 wc sum.c wc -l *.c makefile start.sh grep在文件中查找字符串 命名 grep(Global regular expression print) 语法 grep 模式 文件名列表 举例 grep O_RDWR *.h grep [0-9]* chapter1 grep [0-9][0-9]* chapter1 grep选项 选项 -n 显示时每行前面显示行号 -v 显示所有不包含模式的行 -i 字母比较时忽略字母的大小写 例:grep -n __DATE__

文档评论(0)

1亿VIP精品文档

相关文档