简单linux查询

1查看日志异常
tailf nohup.out|grep ERROR -A 3 --color
 
tailf nohup.out|grep ERROR|grep chunk -A 3 -B 3 --color
 
nohup ./curl_14.sh 50 10000 200 100 &
 
 
2查看历史操作
vi ~/.bash_history
vi ~/.history
 
 
 
3常用命令
ps -ef|grep tomcat
 
nohup ./start.sh &
 
ps -ef|grep curl
 
pkill  -f curl
 
mkdir consumer_12
cp curl_12 consumer_12
 
 
4查看异常数量
grep  "connection timed out" -B 1 ./nohup.out| grep "ConsumerController" |wc -l
 
5定时任务
定时任务shell
crontab -e编辑
crontab -l查看
 
server crond status查看cron服务状态
service crond start启动
 
 
分页打印
cat -n test.log |grep "debug" |more
查看保存到新文件
cat -n test.log |grep "debug"  >debug.txt
 
 
c统计
n行号
grep与find命令的区别:grep搜索的是文本,find搜索的是文件,换句话说就是grep是查找匹配条件的行,find是搜索匹配条件的文件。
 
 
拷贝文件内容到新的目录下的产生一个文件
cat nohup.out > ../curllognodelete/nohup12_
 
6 解压命令
1、*.tar 用 tar –xvf 解压
2、*.gz 用 gzip -d或者gunzip 解压
3、*.tar.gz和*.tgz 用 tar –xzf 解压
4、*.bz2 用 bzip2 -d或者用bunzip2 解压
5、*.tar.bz2用tar –xjf 解压
6、*.Z 用 uncompress 解压
7、*.tar.Z 用tar –xZf 解压
8、*.rar 用 unrar e解压
9、*.zip 用 unzip 解压
压缩文件夹
tar -zcvf /home/xahot.tar.gz /xahot
tar -zcvf 打包后生成的文件名全路径 要打包的目录
子:把/xahot文件夹打包后生成一个/home/xahot.tar.gz的文件。
 
7显示行号
 
输入命令:
    set nu
或者
    set number
取消显示行号
命令:
    set nonu
或者
    set nonumber
8
chown:更改文件属主,也可以同时更改文件属组
chmod:更改文件9个属性
posted @ 2019-04-17 12:16  一心二念  阅读(211)  评论(0编辑  收藏  举报