linux系统下怎么修改path环境变量?

linux系统下怎么修改path环境变量?,第1张

linux修改PATH环境变量四种方式:

Linux修改PATH环境变量的四种方式,每种方式有不同的权限。以添加mongodb server变量为列:

1.修改临时型的PATH

查看PATH:echo $PATH

修改方法一:export PATH=/usr/local/mongodb/bin:$PATH

//配置完后可以通过echo $PATH查看配置结果。

生效方法:立即生效

有效期限:临时改变,只能在当前的终端窗口中有效,当前窗口关闭后就会恢复原有的path配置。

用户局限:仅对当前用户

2.修改当前用户的PATH

通过修改.bashrc文件:vim ~/.bashrc

//在最后一行添上:export PATH=/usr/local/mongodb/bin:$PATH

生效方法:(有以下两种)

1、关闭当前终端窗口,重新打开一个新终端窗口就能生效

2、输入“source ~/.bashrc”命令,立即生效

有效期限:永久有效

用户局限:仅对当前用户

3.修改所有用户的PATH

通过修改profile文件:vim /etc/profile/export PATH

//找到设置PATH的行,添加:

export PATH=/usr/local/mongodb/bin:$PATH

生效方法:系统重启

有效期限:永久有效

用户局限:对所有用户

4.修改系统环境的PATH

通过修改environment文件:vim /etc/environment

在PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"中加入入“:/usr/local/mongodb/bin”

生效方法:系统重启

有效期限:永久有效

用户局限:对所有用户

27种用法格式 :

用法说明

1、 pm list packages : prints all packages, optionally only those whose package name contains the text in FILTER. Options:

例子:列出系统中所有packages

2、 pm list permission-groups : prints all known permission groups.

例子:

3、 pm list permissions : prints all known permissions, optionally only those in GROUP. Options:

例子:列出系统所有许可

4、 pm list instrumentation : use to list all test packagesoptionally supply to list the test packages for a particular application. Options:

-f: list the .apk file for the test package.

5、 pm list features : prints all features of the system.

例子:列出所有手机特性

6、 pm list users : prints all users on the system.

例子:

7、 pm path : print the path to the .apk of the given PACKAGE.

例子:按包名查找apk文件所在路径

8、 pm dump : print system state associated with the given PACKAGE.

9、 pm install : installs a package to the system. Options:

例子:

10、 pm uninstall : removes a package from the system. Options:

-k: keep the data and cache directories around after package removal. 保留数据

例子:

11、 pm clear : deletes all data associated with a package..

例子:只删除数据

12、 pm enable, disable, disable-user, disable-until-used : these commands change the enabled state of a given package or component (written as "package/class").

13、 pm grant, revoke : these commands either grant or revoke permissions to applications. Only optional permissions the application has declared can be granted or revoked.

14、 pm get-install-location : returns the current install location.

15、 pm set-install-location : changes the default install location.

NOTE: this is only intended for debuggingusing this can cause applications to break and other undersireable behavior.

16、 pm trim-caches : trim cache files to reach the given free space.

17、 pm create-user : create a new user with the given USER_NAME, printing the new user identifier of the user. 创建新用户

18、 pm remove-user : remove the user with the given USER_IDENTIFIER, deleting all data associated with that user 。 按用户ID删除用户


欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/yw/7509255.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-06
下一篇 2023-04-06

发表评论

登录后才能评论

评论列表(0条)

保存