简体   繁体   English

更改dot.profile和.bashrc

[英]Changing dot.profile and .bashrc

I need to change my dot.profile and .bashrc files in ubuntu 16.04 so that I can set up my android developer. 我需要在ubuntu 16.04中更改我的dot.profile和.bashrc文件,以便可以设置我的Android开发人员。 I can't save the files after I change them in an editor because they have root permissions but I can't change the permissions either. 我在编辑器中更改文件后无法保存文件,因为它们具有root权限,但我也不能更改权限。 I need to set the 'JAVA_HOME' path in /etc/environment or ~/.bashrc configuration to the 'jdk1.8.0_45'. 我需要将/ etc / environment或〜/ .bashrc配置中的'JAVA_HOME'路径设置为'jdk1.8.0_45'。 Also I need to run /bin/bash --login everytime I run my terminal so that the path is set up right etc. 另外我每次运行终端时都需要运行/ bin / bash --login,以便正确设置路径等。

Can anyone help with these few minor problems? 任何人都可以帮助解决这几个小问题吗?

Im not sure why I got downvoted... 我不确定为什么我会投票否决...

The file /etc/environment and /etc/bash.bashrc and /etc/profile are owned by root, as most files in that directory /etc . 文件/etc/environment/etc/bash.bashrc/etc/profile由root拥有,因为该目录/etc大多数文件。 That is expected and should be so. 这是预期的,应该如此。

The files at ~/ aka $HOME which is usually /home/username should contain .bashrc and .profile : ~/ aka $HOME的文件通常是/home/username应包含.bashrc.profile

$ ls ~/.bashrc ~/.profile
/home/user/.bashrc  /home/user/.profile

Those file should be own by the user, as is the usual in that directory. 这些文件应由用户拥有,就像在该目录中一样。

If those files are own by root, change it. 如果这些文件是根用户拥有的,请对其进行更改。 I Ubuntu: 我在Ubuntu:

$ sudo chown user:user ~/.bashrc ~/.profile

Please: use the correct user name !! 请:使用正确的用户名!

In any case, there should not be any dot.profile in any of both directories, and if it exist, you may confidently erase it. 无论如何,两个目录中都不应有任何dot.profile ,如果存在,则可以放心地删除它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM