如何永久设置在Linux上$ PATH? [英] How to permanently set $PATH on Linux?

查看:160
本文介绍了如何永久设置在Linux上$ PATH?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个目录添加到我的路径,以便它总是会在我的Linux路径。我试过:

I'm trying to add a directory to my path so it will always be in my Linux path. I've tried:

export PATH=$PATH:/path/to/dir

这个工作,但每次我退出终端,并开始一个新的终端的实例,此路径丢失,我需要再次运行export命令。

This works, however each time I exit the terminal and start a new terminal instance, this path is lost, and I need to run the export command again.

我怎么能做到这一点所以这将是永久设置?

How can I do it so this will be set permanently?

推荐答案

您需要将它添加到您的〜/ .profile文件文件。

You need to add it to your ~/.profile file.

export PATH=$PATH:/path/to/dir

根据你在做什么,你可能还需要符号链接到二进制文件:

Depending on what you're doing, you also may want to symlink to binaries:

cd /usr/bin
sudo ln -s /path/to/binary binary-name

这篇关于如何永久设置在Linux上$ PATH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆