Skip to content

Commit 592c607

Browse files
committed
feat: 增加dpkg,apt查看已安装软件列表
1 parent 5e74419 commit 592c607

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Docs/Articles/Shell/特别实用的shell命令.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ tags:
44
---
55
# 特别实用的shell命令
66

7+
## 查看已安装的软件列表
8+
::: code-group
9+
```shell [dpkg]
10+
# 查看已安装软件列表
11+
dpkg --get-selections
12+
# 列表很长,可以输出到文件中查看
13+
dpkg --get-selections > dpkg_installed_list.txt
14+
# 搜索特定软件包是否安装
15+
dpkg -l | grep docker
16+
```
17+
```shell [apt]
18+
# 查看已安装软件列表
19+
apt list --installed
20+
# 列表很长,可以输出到文件中查看(输出的内容比dpkg更详细,包括软件,版本号,平台等信息)
21+
apt list --installed > apt_installed_list.txt
22+
# 搜索特定软件包是否安装
23+
apt list --installed | grep docker
24+
```
25+
:::
26+
727
## 进程名查看进程信息
828
```shell
929
ps -ef | grep docker
@@ -16,8 +36,30 @@ sudo netstat -lnp | grep id
1636

1737
## 杀死进程
1838
```shell
39+
# 使用kill命令杀死进程
1940
kill -s 9 id
41+
42+
# 安装killport,使用脚本杀死进程
43+
curl -sL https://bit.ly/killport | sh
44+
# 终端无法连接的话,可以先浏览器访问,复制脚本保存到本地install.sh中,手动执行安装
45+
bash install.sh
46+
# 添加killport到PATH中
47+
sudo gedit /etc/profile
48+
# 编辑,保存
49+
export KILLPORT="/home/muyi086/.local/bin"
50+
export PATH=$KILLPORT:$PATH
51+
# 使环境变量生效
52+
source /etc/profile
53+
# 杀死指定进程
54+
killport 8080
55+
2056
```
57+
::: warning 注意
58+
报错 `No service found using port`
59+
60+
已提 `issue` : https://github.com/jkfran/killport/issues/43 ,等作者修复
61+
:::
62+
2163

2264
## 查找目录
2365
```shell

0 commit comments

Comments
 (0)