From 30a657398715d738bda468488fe1327ec0693294 Mon Sep 17 00:00:00 2001 From: zzzxy <2132446376@qq.com> Date: Mon, 24 Jun 2024 19:30:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...57\345\242\203\345\217\230\351\207\217.md" | 35 ++++++++++++++++ ...33\347\250\213\347\256\241\347\220\206.md" | 31 ++++++++++++++ ...15\345\212\241\347\256\241\347\220\206.md" | 42 +++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 "22\351\202\271\345\220\221\345\216\237/2024-06-18-\347\216\257\345\242\203\345\217\230\351\207\217.md" create mode 100644 "22\351\202\271\345\220\221\345\216\237/2024-06-19-\350\277\233\347\250\213\347\256\241\347\220\206.md" create mode 100644 "22\351\202\271\345\220\221\345\216\237/2024-06-22-\346\234\215\345\212\241\347\256\241\347\220\206.md" diff --git "a/22\351\202\271\345\220\221\345\216\237/2024-06-18-\347\216\257\345\242\203\345\217\230\351\207\217.md" "b/22\351\202\271\345\220\221\345\216\237/2024-06-18-\347\216\257\345\242\203\345\217\230\351\207\217.md" new file mode 100644 index 0000000..e935a17 --- /dev/null +++ "b/22\351\202\271\345\220\221\345\216\237/2024-06-18-\347\216\257\345\242\203\345\217\230\351\207\217.md" @@ -0,0 +1,35 @@ +## 环境变量 + +### 分类 + +- 按周期分: + - 永久的:在环境变量脚本文件中配置,用户每次登陆时都会自动执行 + - 临时的:用户利用export命令,在当前终端下声明环境变量,关闭shell终端失效 +- 按作用域分: + - 系统环境变量:全局的,对所有用户生效 + - 用户环境变量:局部的,私有的,只对该用户生效 + +1. ### 系统级环境变量 + +系统环境变量对所有用户和进程都可见,常见的配置文件包括(/etc/profile和/etc/environment) + +2. ### 用户级环境变量 + +每个用户独立设置的,只对该用户及其相关进程可见,这些变量可以在登陆时通过不同的配置文件(如:.bashrc、.bash_profile、.profile等) + +### 常见的环境变量及用法 + +#### 系统级 + +- PATH:可执行文件的搜索路径 +- LANG:定义系统语言环境和字符集 +- LANGUAGE:用于设置消息语言的优先级,提示语言为中文 +- EDITOR:默认文本编辑器 editor + +#### 用户级 + +- HOME:当前用户的主目录 +- USER:当前用户名 +- UID:当前用户的用户ID +- SHELL:当前用户的默认shell +- 9 \ No newline at end of file diff --git "a/22\351\202\271\345\220\221\345\216\237/2024-06-19-\350\277\233\347\250\213\347\256\241\347\220\206.md" "b/22\351\202\271\345\220\221\345\216\237/2024-06-19-\350\277\233\347\250\213\347\256\241\347\220\206.md" new file mode 100644 index 0000000..fc7e213 --- /dev/null +++ "b/22\351\202\271\345\220\221\345\216\237/2024-06-19-\350\277\233\347\250\213\347\256\241\347\220\206.md" @@ -0,0 +1,31 @@ +进程管理 + +1. systemctl和service + + - 启动服务 : systemctl start 服务名 service 服务名 start + - 停止服务 : systemctl stop 服务名 service 服务名 stop + - 重启服务 : systemctl restart 服务名 service 服务名 restart + - 查看服务 : systemctl status 服务名 service 服务名 status + - 重新加载配置文件 : systemctl reload 服务名 + +2. ps 列出当前正在运行的进程 + + ``` + ps -aux:显示所有用户的所有进程 + ps -ef :以完整格式显示所有进程 ( |grep 关键字) + ``` + +3. kill 终止指定进程 + + ``` + kill 进程号 + kill -9 pid(进程号) 强制终止进程 + + pstree(以树结构显示进程,要下载安装包psmisc) + ``` + +4. bg 将进程放到后台执行 + + fg 将进程放到前台执行 + +5. top 实时监控进程 \ No newline at end of file diff --git "a/22\351\202\271\345\220\221\345\216\237/2024-06-22-\346\234\215\345\212\241\347\256\241\347\220\206.md" "b/22\351\202\271\345\220\221\345\216\237/2024-06-22-\346\234\215\345\212\241\347\256\241\347\220\206.md" new file mode 100644 index 0000000..e812c8b --- /dev/null +++ "b/22\351\202\271\345\220\221\345\216\237/2024-06-22-\346\234\215\345\212\241\347\256\241\347\220\206.md" @@ -0,0 +1,42 @@ +## 服务管理 + +启动服务:start + +```bash +#service nginx start + +#systemctl start nginx + +#/etc/init.d/nginx +语法: +service + 服务 + 操作选项 <=> /etc/init.d/服务+操作选项 +``` + +关闭服务:stop + +```bash +#service nginx stop + +#systemctl stop nginx +``` + +重启服务:restart + +```bash +#service nginx restart + +#systemctl restart nginx +``` + +查看状态:status + +```bash +#service nginx status + +#systemctl status +``` + + + + + -- Gitee