权限
//给文件夹权限
chmod +777 -R 文件夹
//给文件夹上用户权限
chown 用户名 文件夹
端口号及进程
//根据端口号看进程
lsof -i:端口号
//根据进程pid看端口号
lsof -i | grep pid
//看所有进程
ps -ef | grep 进程名
日志及查找文件
tail -f 数量 文件名
grep 名称 文件名
cat 文件名
vim 文件
//查找文件
find / -name 文件名称/文件夹
//统计某个字符串在文件中出现的次数
grep -o “info” a.txt | wc -l
执行文件
// 后台执行
nohup ./可执行文件 > /dev/null &
文件移动
//复制
cp -r 文件 文件
//移动
mv 文件 文件
远程debug(自用)
JVM_ARGS=" -Xms3g -Xmx3g -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseCMSInitiatingOccupancyOnly -Xloggc:log/gc.log -XX:+PrintGCDetails"
判断环境变量
PROFILE=“dev”
if [ "
2
"
x
=
"
t
e
s
t
"
x
−
o
"
{2}"x = "test"x -o "
2"x="test"x−o"{2}"x = "qa"x ]; then
PROFILE=“test”
if [ KaTeX parse error: Expected 'EOF', got '#' at position 1: #̲ -eq 3 ]; then …{3}
fi
elif [ "${2}"x = "stable"x ]; then
PROFILE=“stable”
else
PROFILE=$2
fi
checkProfile(){
local cluster_file=“.deploy/service.cluster.txt”
if [ -f “$cluster_file” ];then
cluster=cat ${cluster_file}
if [[
c
l
u
s
t
e
r
=
"
−
p
r
e
"
]
]
;
t
h
e
n
P
R
O
F
I
L
E
=
"
p
r
e
"
J
V
M
A
R
G
S
=
"
cluster =~ "-pre" ]];then PROFILE="pre" JVM_ARGS="
cluster= "−pre"]];thenPROFILE="pre"JVMARGS="{JVM_ARGS} -Denv=uat"
else
PROFILE=“prod”
JVM_ARGS=“
J
V
M
A
R
G
S
−
D
e
n
v
=
p
r
o
"
f
i
e
l
s
e
J
V
M
A
R
G
S
=
"
{JVM_ARGS} -Denv=pro" fi else JVM_ARGS="
JVMARGS−Denv=pro"fielseJVMARGS="{JVM_ARGS} -Denv=dev”
fi
}
checkEnableXdebug(){
if [ ${2}x = "debug"x -o
3
x
=
"
d
e
b
u
g
"
x
−
o
"
{3}x = "debug"x -o "
3x="debug"x−o"{PROFILE}"x = "dev"x -o "
P
R
O
F
I
L
E
"
x
=
"
t
e
s
t
"
x
−
o
"
{PROFILE}"x = "test"x -o "
PROFILE"x="test"x−o"{PROFILE}“x = “pre"x ];then
JVM_ARGS=”${JVM_ARGS} -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=8082,suspend=n”
echo “enable xdebug”
fi
}