查找特定的文件
- find
语法: find path [options] params
find / -name 'test.txt'
: 精确查找文件find / -name 'test*'
: 模糊查找文件find / -iname 'test*'
: 不区分文件名大小写查找文件
- find
检索文件内容
- grep
语法: grep path [options] pattern file
grep 'abc' test.txt
grep -o 'abc'
筛选符合条件的内容ps -ef | grep mysql | grep -v 'grep'
-v 过滤
- grep
对文件内容做统计
- awk
语法: awk path [options] 'cmd' file
awk '{print $1, $4}' test.txt
awk '$1=="tcp" && $2== "1" {print $1, $4}' test.txt
awk -F ',' {print $1}' test.txt
-F: 指定分隔符awk '{arr[$1]++}END{for (i in arr)print i "\t" arr[i]}' test.txt
- awk
批量替换文本内容
- sed
语法: sed [options] 'sed command' file
sed -i 's/^Str/String/' test.txt
-i : 替换sed -i 's/^Str/String/g/' test.txt
-g : 全部替换
- sed
上传文件到服务器
scp -P 40022 /home/john/test.txt ycadmin@1.2.3.4:/home/ycadmin/test.txt
从服务器下载文件
scp -P 40022 ycadmin@1.2.3.4:/home/ycadmin/test.txt /home/john/test.txt
查看端口
netstat -ntlp
ubuntu配置openssh-server开机自动启动
sudo vim /etc/rc.local 在exit 0语句前加入:/etc/init.d/ssh start
部署Spring Boot应用
java -Dspring.profiles.active=test -jar demo-0.0.1-SNAPSHOT.jar &
转载于:https://www.cnblogs.com/liuweiqc/p/11055619.html