日常操作linux常用命令
Posted hysen31
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了日常操作linux常用命令相关的知识,希望对你有一定的参考价值。
cd /mnt/opt/cqstt/logs/stt-erp
docker logs -f --tail=1000 stt-erp
# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l
#撤销commit
git reset --soft HEAD^
#批量删除本地分支
git branch | grep 'xxx' |xargs git branch -D
#删除本地分支
git branch -d xxx
#删除远程分支
git push origin --delete xxx
#批量删除远程分支
git branch -r| grep 'branchName' | sed 's/origin\\///g' | xargs -I git push origin :
#查找
find / -name '*xx*'
#设置保存git密码
git config --global credential.helper store
#
git branch --contains 28598cd72c5df9501xxxx589c84c8
#查看端口占用
netstat -tunlp | grep 7080
netstat -ano | findstr "8848"
#文件个数
ls -l | wc -l
#查询进程
pidof java
#显示进程信息
top -p 123,32123
#安装deb
dpkg -i
#删除文件
find . -name "*.iml" | xargs rm -rf
#重启桌面
sudo systemctl restart lightdm
#截取文件名称
basename -s .jpg *.jpg
echo $(basename -s .jpg *.jpg) > file.txt
#文件个数
find . -type f -print | wc -l
#生成iml
mvn idea:module
sudo systemctl restart mysql.service
#修改mysql认证方式
ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY 'root';
#clickhouse
sudo systemctl start clickhouse-server
#maven强制更新jar
mvn dependency:purge-local-repository
mvn clean install -U
nohup dbeaver &
rm -rf /opt/maven/repository/com/baomidou
rm -rf /opt/maven/repository/com/alibaba/druid*
rm -rf /opt/maven/repository/com/github/jsqlparser/
rm -rf /opt/maven/repository/com/github/pagehelper/
rm -rf /opt/maven/repository/io/seata*
rm -rf /opt/maven/repository/com/alibaba/cloud/*seata*
rm -rf /opt/maven/repository/org/springframework/cloud/*gateway*
java -jar -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=10000 /mnt/opt/cqstt/stterp-8082/stt-erp-1.1.1.BETA.jar --server.port=8082 --spring.profiles.active=test
#查询外网地址
curl ifconfig.me
ip addr show
git init
git remote add origin https://github.com/hy7873/common-utils.git
#批量杀进程
ps -ef | grep WeChat | grep -v grep | awk 'print "kill -9 "$2' | sh
./redis-server redis.conf --protected-mode no
du -h --max-depth=1
#cpu
top -c
top -Hp 4075
jstack -l 2794 > ./2794.stack
#内存
jmap -heap 4075
jmap -histo 4075 | head -n 10 > test.txt
jmap -dump:live,format=b,file=dump.hprof 15945
./ParseHeapDump.sh hummer.hprof org.eclipse.mat.api:suspects org.eclipse.mat.api:overview org.eclipse.mat.api:top_components
ps p 20179 -L -o pcpu,pmem,pid,tid,time,tname,cmd
jps -ml
watch com.letus.omsapi.client.OMSClient paySuccessOpt "params,returnObj" -x 2
tt -t com.letus.omsapi.client.OMSClient paySuccessOpt -n 3
ll -l | grep "^-" | wc -l
rar a xx.rar /etc/aa/
rar x aa.rar
#转16进制
printf '%x\\n' 123
#win中运行jar
chcp 65001 或者设置环境变了 JAVA_TOOL_OPTIONS
java -jar xx.jar
#代理服务设置
systemctl status firewalld.service
systemctl start firewalld.service
systemctl stop firewalld.service
firewall-cmd --zone=public --add-port=5672/tcp --permanent # 开放5672端口
firewall-cmd --zone=public --remove-port=5672/tcp --permanent #关闭5672端口
firewall-cmd --reload # 配置立即生效
python3 /root/shadowsocks/shadowsocks/server.py -m aes-256-cfb -p 44433 -k wh001011
python3 /root/shadowsocks/shadowsocks/server.py -m aes-256-cfb -p 3389 -k wh001011
nohup python3 /root/shadowsocks/shadowsocks/server.py -m aes-256-cfb -p 3389 -k wh001011 &
netstat -anp
#批量删除
find . -name '16*' -or -name '24*' | xargs rm -rf
#编辑jar
jar -xvf xxx.jar
jar -cvf xxx-new.jar BOOT-INF/ META-INF/ org/
#热部署
sc -d *EnumUtils
redefine -c hashcode /xx/xx/xx.class
jad com.xx.cc.EnumUtils
#手动GC
jcmd 21038 GC.run
#修改文件权限
chmod -R a=wrx /mnt/opt/ a u o g
uname -a
cat /proc/version 内核版本
lsb_release -a 系统版本
mkdir -p /mnt/opt/
netstat -tunlp
#批量重命名
rename 's/PNG/png/' * debian
rename from to files centos
以上是关于日常操作linux常用命令的主要内容,如果未能解决你的问题,请参考以下文章