Skip to content

Instantly share code, notes, and snippets.

@lhcpig
Last active October 15, 2015 05:14
Show Gist options
  • Save lhcpig/8b725b6d12aa5989ee94 to your computer and use it in GitHub Desktop.
Save lhcpig/8b725b6d12aa5989ee94 to your computer and use it in GitHub Desktop.
useful command note
./command -yes -no /home/username
$# = 3
$* = -yes -no /home/username
$@ = array: {"-yes", "-no", "/home/username"}
$0 = ./command, $1 = -yes etc.
chkconfig --list #列出所有的系统服务
chkconfig --add httpd #增加httpd服务
chkconfig --del httpd #删除httpd服务
chkconfig --level httpd 2345 on #设置httpd在运行级别为2、3、4、5的情况下都是on(开启)的状态
chkconfig --list #列出系统所有的服务启动情况
chkconfig --list mysqld #列出mysqld服务设置情况
chkconfig --level 35 mysqld on #设定mysqld在等级3和5为开机运行服务,--level 35表示操作只在等级3和5执行,on表示启动,off表示关闭
chkconfig mysqld on #设定mysqld在各等级为on,“各等级”包括2、3、4、5等级
set names utf8 #mysql命令行中输入,解决中文乱码问题
#安装这个模块和其依赖的模块
mvn clean install -pl [module] -am -DskipTests
#同步mongo和solr之间的数据
mongo-connector -m localhost:27117 -t http://localhost:8983/solr/[solr.core] -d solr_doc_manager -a [mongo.user.name] -p [mongo.user.password] -n sns.[collection]
#下载jdk8
nohup wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.rpm" &
nohup wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz" &
# delete keys matching a pattern
redis-cli -n 5 keys "prefix:*" | xargs redis -n 5 del
EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 prefix:*
EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 prefix:*
for _,k in ipairs(redis.call('keys', ARGV[1])) do
redis.call('del', k)
end
#利用top的交互命令数字1查看那每个CPU的性能数据
#查看已经使用了多少个数据库连接
netstat -nat | grep 3306 -c
#查看java线程个数
ps -eLF | grep java -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment