linux - 使用 source .profile 提示找不到 .profile
ringa_lee
ringa_lee 2017-04-17 16:53:26
0
5
1294

在Linux 上无法使用 source ~/.profile ,

Bash 提示bash: /home/username/.profile:: 没有那个文件或目录,

但是使用 ls -a 却可以显示该文件,而且文件内的配置可以被系统正常读取。

ringa_lee
ringa_lee

ringa_lee

reply all(5)
阿神

The problem has been solved. When using vim, I accidentally entered a symbol at the beginning of the .profile file.

阿神

Picture bar, take screenshots of command execution and results

伊谢尔伦

The directory is wrong. The user root directory (root user) is ~/.bash_profile, and the path is /root/.bash_profile
I remember that there is a profile file, but I forgot which directory it is in. Please check it carefully. Check out the files and directories;

刘奇

Explanation on closing the profile file first in Linux:

/etc/profile: This file sets environment information for each user of the system. When the user logs in for the first time, this file is executed. And collects shell settings from the configuration file in the /etc/profile.d directory, globally To take effect, just use source profile

~/.bash_profile: Each user can use this file to enter shell information dedicated to their own use. When the user logs in, this file is only executed once! By default, some environment variables are set and the user's .bashrc file is executed. This file is similar to /etc/profile, and it also needs to be restarted to take effect. /etc/profile takes effect for all users, and ~/.bash_profile only takes effect for the current user.

The .profile file only exists in the root home directory.

阿神

source /root/.bashrc

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!