Henry
发布于 2025-02-21 / 5 阅读
0
0

Linux - 全局添加环境变量

背景简介

全局更新配置 PATH 环境变量。

环境配置

  1. 系统:Debian 6.1.66-1 (2023-12-09) x86_64 GNU/Linux

详细步骤

第一步: 修改 /etc/profile 配置文件,添加环境变量

root@pega-minikube-poc:~# cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

******


# 添加的配置
export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin

第二步: 使用 source 指令使配置生效,也可通过重启生效

root@pega-minikube-poc:~# source /etc/profile

以上便是本文的全部内容,感谢您的阅读。



评论