Linux操作系统:从$ PATH变量中删除路径 [英] Linux: Remove path from $PATH variable

查看:235
本文介绍了Linux操作系统:从$ PATH变量中删除路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是太熟悉Linux和定义在$ PATH变量6次相同的路径。我没有注销,以检查它是否奏效。
我怎样才能删除重复?

I'm not too familiar with Linux and have defined the same path in the $PATH variable 6 times. I wasn't logging out to check whether it worked. How can I remove the duplicates?

$ PATH变量看起来是这样的:

The $PATH variable looks like this:

echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin

我将如何恢复它只是

How would I reset it to just

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

非常感谢!

推荐答案

您只需执行:

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

这将是本届会议上,如果你想改变其永久添加到任何的.bashrc,bash.bashrc,/ etc / profile文件 - 任何适合您的系统和用户的需求。

that would be for the current session, if you want to change permanently add it to any .bashrc, bash.bashrc, /etc/profile - whatever fits your system and user needs.

这篇关于Linux操作系统:从$ PATH变量中删除路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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