1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#显示系统信息
uname -a
cat /proc/cpuinfo

#显示磁盘空间使用情况
df -h

#显示当前目录磁盘占用情况
du -sh

#按照大小列出当前文件夹前10个磁盘占用
du -h / | sort -hr | head -n 10

#内存占用情况排序
ps aux --sort -rss
ps aux --sort -%mem
ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -rn

#从远程服务器拷贝文件到本地目录
scp user@ip:/remote_path /local_path

#将文件拷贝到远程服务器
scp file.txt user@ip:/remote_path

#在目录下查找含有某个字符串的文件
find /folder_name -name 'prefix*'

grep -rnw '/path/to/somewhere/' -e 'pattern'

grep -Ril "text-to-find-here" /

grep -r "string to be searched" /path/to/dir

#查找目录下大于多少M的文件
find /folder_name -size +100M

#为当前目录创建压缩包
tar czf archive.tar.gz directory

#解压文件
tar xzf archive.tar.gz

#创建一个软连接
ln -s source_file link

#列出用户打开的文件
lsof -u user

#列出端口占用情况
lsof -i:80
lsof -i -P -n | grep LISTEN
netstat -tulpn | grep LISTEN
nc -vz 192.168.2.254 80

#检查域名或IP服务器端口打开情况
nmap baidu.com
nmap 13.384.239.67

#awk命令
#-F设置分隔符是: 默认是,
cat /etc/passwd | awk -F: '{print $1,$6}'

#OFS设置输出的连接符
date | awk 'OFS="-" {print$6,$2,$3}'

#输出第一列
who | awk '{print $1}'

#git切换到上一个分支
git checkout -

#docker查看容器内存占用情况
docker stats --no-stream

#docker显示磁盘使用情况
docker system df -v


终端录制

Terminal session recorder

crontab调试工具

https://crontab.guru/

参考引用

https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/

Shell Tutorial

https://www.tecmint.com/free-online-linux-learning-guide-for-beginners/

linux awk

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/

https://kubernetes.io/zh-cn/

常用命令

https://github.com/mingongge/BestSRE

计算机网络