首页 > 系统服务 > 详细

linux 查看命令

时间:2017-11-09 11:12:26      阅读:248      评论:0      收藏:0      [点我收藏+]

grep :查看文本文件内容,显示包含指定“字符串”的行。
  格式:grep  [选项]  ‘匹配字符串’  文本文件

  例: grep ‘ root‘    /etc/passwd
       grep -i  ‘Root‘ /etc/passwd   忽略大小写
       grep  -v ‘root‘ /etc/passwd   取反,不包含
       grep  ‘^root‘   /etc/passwd   以字符串root开头
       grep  ‘root$‘   /etc/passwd   以字符串root结尾
       grep  -v  ‘^$‘  /etc/passwd   去除空行的显示
   
  find:按条件查找
        根据预设的条件递归查找对应文件
      格式: find  [目录]  [条件]
      常用条件表示:
              -type类型(f文件,d目录,l快捷方式)
              -name "文档名称"
              -size + 文件大小(k,M,G)
              -user   用户名
   例:find /boot -type  f
       find /boot  -name  "passwd"
       find /boot  -name  "install*"  -type  d
       find /boot  -name  "*.txt"  -type f  -size + 10M
      
   使用find命令的-exec操作
   格式:find  -exec  处理命令  {} \; 
   例: find / -user  xixi  -type f  -exec cp  -r  {}/root/ \;
     找到根下的用户xixi文件复制到/root下
 
  cat    适合查看内容较少
  less   适合查看内容较多的
  head -n   看头几行
  tail -n    看尾几行 
  正则表达式:用描述的语言去表达心中所想。
 
 


linux 查看命令

原文:http://13399294.blog.51cto.com/13389294/1980135

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!