当前位置: 首页 > news >正文

[短笔记] Ubuntu配置环境变量的最佳实践

结论:

  • 不确定是否要设为系统,则先针对当前用户设,写~/.profile
  • 确定为系统级,写/etc/environment,注意无需export
  • 不推荐写在~/.bashrc(Ubuntu不推荐,理由见references)

References:

  • https://help.ubuntu.com/community/EnvironmentVariables
  • https://askubuntu.com/questions/866161/setting-path-variable-in-etc-environment-vs-profile

There are other ways environment variables are set when users log in that depend more heavily on the type of login. For example, you may occasionally have environment variables that get set just for graphical logins or just for SSH-based remote logins. The list above does not cover such cases.

I’ve left out a few files where people sometimes define environment variables, like ~/.bashrc and /etc/bash.bashrc, because they are not generally recommended places to set PATH and it is rare that you should actually use them for this purpose. If you use these files to add directories to PATH, then they will sometimes be added many times and is very confusing when you examine $PATH. (In extreme cases this may slow things down, but usually it’s just a matter of keeping everything clean and understandable.)

http://www.lryc.cn/news/401696.html

相关文章:

  • 怎样在 PostgreSQL 中优化对多表关联的连接条件选择?
  • 【Flowable | 第四篇】flowable工作流多任务实例节点实现会签/或签
  • 解决C#读取US7ASCII字符集oracle数据库的中文乱码
  • Linux驱动开发中设备节点、虚拟节点、逻辑节点之间的区别与关系
  • 【iOS】——ARC源码探究
  • ubuntu服务器安装labelimg报错记录
  • Transformer中Decoder的计算过程及各部分维度变化
  • QT实现滑动页面组件,多页面动态切换
  • 使用Python-docx库创建Word文档
  • C# 设计一个可变长度的数据通信协议编码和解码代码。
  • 【MATLAB库函数系列】MATLAB库函数pwelch之功率谱估计的详解及实现
  • 科技出海|百分点科技智慧政务解决方案亮相非洲展会
  • Prometheus 云原生 - Prometheus 数据模型、Metrics 指标类型、Exporter 相关
  • Qt窗口程序整理汇总
  • 简单实现一个本地ChatGPT web服务(langchain框架)
  • Elasticsearch-多边形范围查询(8.x)
  • Kotlin Misk Web框架
  • 【设计模式之美】【建造型】工厂模式:通过面向接口编程思路,串起业务流程
  • AI算法19-偏最小二乘法回归算法Partial Least Squares Regression | PLS
  • live555关于RTSP协议交互流程
  • Centos7 安装私有 Gitlab
  • 浅谈数学模型在UGC/AIGC游戏数值配置调参中的应用(AI智能体)
  • 第T5周:使用TensorFlow实现运动鞋品牌识别
  • 网络编程学习之tcp
  • 前端XMLHttpRequest、Fetch API、Axios实现文件上传、下载方法及后端Spring文件服务器处理方法
  • STM32智能交通监测系统教程
  • 【利用Selenium+autoIt实现文件上传】
  • python join
  • cython加速python代码
  • React@16.x(60)Redux@4.x(9)- 实现 applyMiddleware