平时工作中经常使用的命令

1、查找eclipse工程中lib下指定的jar包名
find . -name ".classpath" -exec grep 'biz.bopsbasicservice' {} \;

查找 private  static final Log log = LogFactory.getLog(Xml2DataParserImpl.class);
find .  |grep -e "\.java$" |xargs grep "LogFactory.getLog" |grep -v static   (commons log4j) find .  |grep -e "\.java$" |xargs grep "LoggerFactory.getLogger" |grep -v static (slf4j)

ls | grep -v pom.xml | xargs -i svn ps svn:ignore -F test.txt {}

有时候关闭软件后,后台进程死掉,导致端口被占用。下面以JBoss端口8083被占用为例,列出详细解决过程。
解决方法:
1.查找被占用的端口
netstat -tlnp
netstat -tlnp | grep 8083
netstat -tlnp 查看端口使用情况,而netstat -tln | grep 8083 则是只查看端口8083的使用情况

2.查看端口属于哪个程序?端口被哪个进程占用
Python代码
Python代码
lsof -i :8083

3.杀掉占用端口的进程

Java代码
kill -9 进程id

常见错误提示解决方法:
apache启动报错(98)Address already in use: make_sock: could not bind to address [::]:80

1.netstat -lnp|grep 80

tcp 0 0 192.168.180.68:61027 0.0.0.0:* LISTEN 6289/oproxyd
tcp 0 0 :::80 :::* LISTEN 846/httpd
tcp 0 0 ::ffff:192.168.180.68:7001 :::* LISTEN 32015/java

找到pid 846

#ps 846

查看
#kill -9 846

杀掉

#./apachectl start

启动成功




猜你喜欢

转载自lancehan.iteye.com/blog/1920907