Skip to content

Commit 5a6e2e9

Browse files
committed
feat: Add a command library component
1 parent f01edf0 commit 5a6e2e9

7 files changed

Lines changed: 1242 additions & 210 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
prompt.txt
3+
dist

frontend/src/assets/commands.json

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
[
2+
{
3+
"category": "系统信息",
4+
"icon": "Monitor",
5+
"commands": [
6+
{
7+
"name": "查看系统版本",
8+
"command": "cat /etc/os-release"
9+
},
10+
{
11+
"name": "查看内核版本",
12+
"command": "uname -a"
13+
},
14+
{
15+
"name": "查看 CPU 信息",
16+
"command": "lscpu"
17+
},
18+
{
19+
"name": "查看内存使用",
20+
"command": "free -h"
21+
},
22+
{
23+
"name": "动态查看资源 (Top)",
24+
"command": "top"
25+
},
26+
{
27+
"name": "动态查看资源 (htop)",
28+
"command": "htop"
29+
},
30+
{
31+
"name": "查看系统运行时长",
32+
"command": "uptime"
33+
}
34+
]
35+
},
36+
{
37+
"category": "磁盘与文件",
38+
"icon": "Folder",
39+
"commands": [
40+
{
41+
"name": "查看磁盘空间",
42+
"command": "df -h"
43+
},
44+
{
45+
"name": "查看当前目录大小",
46+
"command": "du -sh *"
47+
},
48+
{
49+
"name": "查找大文件 (>100M)",
50+
"command": "find / -type f -size +100M -exec ls -lh {} \\; | awk '{ print $9 \": \" $5 }'"
51+
},
52+
{
53+
"name": "清空文件内容",
54+
"command": "> filename.log"
55+
},
56+
{
57+
"name": "查看日志尾部",
58+
"command": "tail -f filename.log"
59+
}
60+
]
61+
},
62+
{
63+
"category": "网络查验",
64+
"icon": "Connection",
65+
"commands": [
66+
{
67+
"name": "查看监听端口",
68+
"command": "netstat -tulnp"
69+
},
70+
{
71+
"name": "查看端口占用 (ss)",
72+
"command": "ss -tulnp"
73+
},
74+
{
75+
"name": "查看 IP 地址",
76+
"command": "ip a"
77+
},
78+
{
79+
"name": "测试网络连通",
80+
"command": "ping -c 4 8.8.8.8"
81+
},
82+
{
83+
"name": "追踪路由节点",
84+
"command": "traceroute google.com"
85+
},
86+
{
87+
"name": "发起 HTTP 请求",
88+
"command": "curl -I https://www.google.com"
89+
}
90+
]
91+
},
92+
{
93+
"category": "进程管理",
94+
"icon": "Cpu",
95+
"commands": [
96+
{
97+
"name": "查看所有进程",
98+
"command": "ps aux"
99+
},
100+
{
101+
"name": "查找 Java 进程",
102+
"command": "ps aux | grep java"
103+
},
104+
{
105+
"name": "查找 Node 进程",
106+
"command": "ps aux | grep node"
107+
},
108+
{
109+
"name": "查找 Nginx 进程",
110+
"command": "ps aux | grep nginx"
111+
},
112+
{
113+
"name": "结束指定的进程",
114+
"command": "kill -9 PID"
115+
}
116+
]
117+
},
118+
{
119+
"category": "Docker 常用",
120+
"icon": "Box",
121+
"commands": [
122+
{
123+
"name": "查看所有容器",
124+
"command": "docker ps -a"
125+
},
126+
{
127+
"name": "查看正在运行",
128+
"command": "docker ps"
129+
},
130+
{
131+
"name": "查看容器日志",
132+
"command": "docker logs -f CONTAINER_ID"
133+
},
134+
{
135+
"name": "查看所有镜像",
136+
"command": "docker images"
137+
},
138+
{
139+
"name": "查看 Docker 资源统计",
140+
"command": "docker stats"
141+
},
142+
{
143+
"name": "清理悬空资源",
144+
"command": "docker system prune -f"
145+
}
146+
]
147+
},
148+
{
149+
"category": "安全与防火墙",
150+
"icon": "Lock",
151+
"commands": [
152+
{
153+
"name": "查看防火墙状态 (Firewalld)",
154+
"command": "systemctl status firewalld"
155+
},
156+
{
157+
"name": "查看防火墙状态 (UFW)",
158+
"command": "ufw status"
159+
},
160+
{
161+
"name": "查看登录成功的用户",
162+
"command": "last"
163+
},
164+
{
165+
"name": "查看登录失败的记录",
166+
"command": "lastb"
167+
}
168+
]
169+
}
170+
]

0 commit comments

Comments
 (0)