首页 > 系统服务 > 详细

Linux 常用命令汇总

时间:2018-06-25 23:53:11      阅读:257      评论:0      收藏:0      [点我收藏+]

一、打包压缩解压

①压缩

tar -czvf Test.tar.gz ./Test

tar -cjvf Test.tar.bz2 ./Test

②解压

tar -xzvf Test.tar.gz

tar -xjvf Test.tar.bz2

 

-c, --create: create a new archive

-z, --gzip: filter the archive through gzip

-v, --verbose: verbosely list files processed

-f, --fIle=ARCHIVE: use archive file or defice ARCHIVE

 

-x, --extract, --get: extract files from an archive

 

二、查找替换

①. 查找指定目录下某一文件

find ./ -name filename

②. 查找指定目录下文件中的字符串

grep -r --color "Str" ./

③. 替换指定目录下文件中的字符串

grep -rl printf ./ | xargs sed -i ‘s/printf/xxxxxx/g‘     --printf -->> xxxxxx

④. 严格匹配替换指定目录下文件中的字符串

grep -rl "printf" ./ | xargs sed -i ‘s/\<printf\>/xxxxxx/g‘

 

grep 选项介绍

-r, -R, --recursive: Read  all  files  under  each  directory,  recursively

-l: Suppress  normal  output; instead print the name of each input file from which output would normally have been printed.

 

Linux 常用命令汇总

原文:https://www.cnblogs.com/wulei0630/p/9226657.html

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