When setting the export path in Unix, example:
在Unix中设置导出路径时,例如:
export PATH=$PATH: $EC2_HOME/bin
If I quit terminal and open it back up to continue working, I have to go through all the steps again, setting up the paths each time. I'm wondering how I can set the path and have it "stick" so my system knows where to find everything the next time I open terminal without having to do it all over again. Thanks!
如果我退出终端并将其重新打开以继续工作,我必须再次完成所有步骤,每次都设置路径。我想知道如何设置路径并让它“坚持”,这样我的系统就知道在下次打开终端时哪里可以找到所有内容而无需重新进行操作。谢谢!
6 个解决方案
#1
15
Open ~/.bashrc.
This file is loaded every time you start up a new shell (if you're using Bash, which most people are). If you're using a different shell, the file may have a different name, like ~/.shrc
.
打开〜/ .bashrc。每次启动新shell时都会加载此文件(如果您使用的是Bash,大多数人都是这样)。如果您使用的是其他shell,则该文件可能具有不同的名称,例如〜/ .shrc。
Add the line you need to the bottom of the file:
将您需要的行添加到文件的底部:
export PATH=$PATH:$EC2_HOME/bi
Other info rolled up from elsewhere in the thread:
其他信息从该线程的其他地方汇总:
There are multiple places to put this, depending on your shell and your needs. All of these files are in your home directory:
根据您的shell和您的需求,有多个地方可以放置它。所有这些文件都在您的主目录中:
For Bash:
.bashrc (executed when you shart a shell)
OR
.bash_profile (executed when you log in)
For csh and tcsh:
对于csh和tcsh:
.cshrc
For sh and ksh:
对于sh和ksh:
.profile
#2
2
Add it to your .cshrc file (for csh and tcsh), .profile file (for sh and ksh), or .bash_profile file (for bash)
将其添加到.cshrc文件(对于csh和tcsh),. profile文件(对于sh和ksh)或.bash_profile文件(对于bash)
#3
1
You need to find your profile file and put that line in there. Suppose you use bash, the profile files are .bashrc and .bash_profile, found in ~. These files will vary depending on which shell you use.
您需要找到您的个人资料文件并将该行放在那里。假设你使用bash,配置文件是.bashrc和.bash_profile,在〜中找到。这些文件将根据您使用的shell而有所不同。
#4
1
You have to put those commands into one of the "autostart" files of your shell.
您必须将这些命令放入shell的“自动启动”文件之一。
For bash this would be .bashrc
in your homedirectory (create it if necessary)
对于bash,这将是你的homedirectory中的.bashrc(必要时创建它)
#5
0
add it to your .bashrc or another .bash startup file.
将它添加到.bashrc或另一个.bash启动文件中。
#6
0
... and for ksh edit .profile.
...和ksh编辑.profile。
#1
15
Open ~/.bashrc.
This file is loaded every time you start up a new shell (if you're using Bash, which most people are). If you're using a different shell, the file may have a different name, like ~/.shrc
.
打开〜/ .bashrc。每次启动新shell时都会加载此文件(如果您使用的是Bash,大多数人都是这样)。如果您使用的是其他shell,则该文件可能具有不同的名称,例如〜/ .shrc。
Add the line you need to the bottom of the file:
将您需要的行添加到文件的底部:
export PATH=$PATH:$EC2_HOME/bi
Other info rolled up from elsewhere in the thread:
其他信息从该线程的其他地方汇总:
There are multiple places to put this, depending on your shell and your needs. All of these files are in your home directory:
根据您的shell和您的需求,有多个地方可以放置它。所有这些文件都在您的主目录中:
For Bash:
.bashrc (executed when you shart a shell)
OR
.bash_profile (executed when you log in)
For csh and tcsh:
对于csh和tcsh:
.cshrc
For sh and ksh:
对于sh和ksh:
.profile
#2
2
Add it to your .cshrc file (for csh and tcsh), .profile file (for sh and ksh), or .bash_profile file (for bash)
将其添加到.cshrc文件(对于csh和tcsh),. profile文件(对于sh和ksh)或.bash_profile文件(对于bash)
#3
1
You need to find your profile file and put that line in there. Suppose you use bash, the profile files are .bashrc and .bash_profile, found in ~. These files will vary depending on which shell you use.
您需要找到您的个人资料文件并将该行放在那里。假设你使用bash,配置文件是.bashrc和.bash_profile,在〜中找到。这些文件将根据您使用的shell而有所不同。
#4
1
You have to put those commands into one of the "autostart" files of your shell.
您必须将这些命令放入shell的“自动启动”文件之一。
For bash this would be .bashrc
in your homedirectory (create it if necessary)
对于bash,这将是你的homedirectory中的.bashrc(必要时创建它)
#5
0
add it to your .bashrc or another .bash startup file.
将它添加到.bashrc或另一个.bash启动文件中。
#6
0
... and for ksh edit .profile.
...和ksh编辑.profile。