美文网首页
常用部署和运维命令(更新中)

常用部署和运维命令(更新中)

作者: 胖腿儿走一个 | 来源:发表于2015-07-23 11:59 被阅读0次

tail命令

实时日志

tail -f nohup.out

带行号的实时日志

tail -f nohup.out | cat -n

倒序查询后100行日志

tail -n -100 nohup.out

顺序查询前100行日志

tail -n 100 nohup.out

grep命令

显示日志中关键字为key的日志和其(-B 前)后5行内容,并着色

grep 'key' -n -A 5 nohup.out --color

远程拷贝文件

scp username@user.ip:/sourcedirectory/file  server name@server.ip:/targetdirectory 

远程拷贝目录

scp -r username@user.ip:/sourcedirectory/file  server name@server.ip:/targetdirectory 

文件权限控制

在tomcat执行sh start.sh时可能出现:

Cannot find ./catalina.sh
This file is needed to run this program

说明没有执行权限,这时候你需要chmod上场了:

chmod +x *.sh

+号是添加权限的意思,x是执行权限。相应的-是删除权限,r是读权限,w是写权限

查看一段时间内的日志

sed -n '/^2016-06-21 19:36/,/^2016-06-21 20:12/p' server.log|more

相关文章

网友评论

      本文标题:常用部署和运维命令(更新中)

      本文链接:https://www.haomeiwen.com/subject/opapqttx.html