how to make the changes to source .profile permanent

41,954

Solution 1

After changing the .profile file, you have to logout from your account and login, then it will be sourced once automatically.

Also make sure these file does not exist in your home directory:

~/.bash_profile
~/.bash_login

If you've got these files, the .profile will be ignored.

Solution 2

~/.profile is evaluated (or “sourced”) automatically whenever a new interactive shell is started. The suggestion to run

source .profile

only refers to shell sessions that were started before the changes to ~/.profile were made.

Therefore you don't need to do anything in addition for these changes to take effect in new/future shell sessions.

Solution 3

I'd say aliases should go in ~/.bash_aliases rather then in ~/.profile, this way you have a nice own file for them and every new opened terminal will have them executed without the need to logout/login.

But to answer you question: To make your changes permanent, you need to do nothing but login once again. source ~/.profile won't be needed any more then.

Share:
41,954

Related videos on Youtube

Ishan Srivastava
Author by

Ishan Srivastava

get the fuck off my profile

Updated on September 18, 2022

Comments

  • Ishan Srivastava
    Ishan Srivastava over 1 year

    I am following the following details from another question on this site

    You can add an alias to the command by editing the file .profile in your home directory:

    gedit $HOME/.profile
    

    and adding the following line:

    alias lock='gnome-screensaver-command -l'
    

    Then from terminal:

    source .profile
    

    This will activate the alias. From now on, the alias lock In a terminal will have the effect of locking the screen.

    But I have to hit source .profile every time I open a new terminal. I want to make this permanent. What should I do?

    • David Foerster
      David Foerster over 6 years
      Could you please edit your question to include a link to the original post cited in your question? Thanks.
  • David Foerster
    David Foerster over 6 years
    Alternatively, have ~/.bash_profile and/or ~/.bash_login evaluate ~/.profile.
  • Redbob
    Redbob over 6 years
    Look also for ~/.bashrc.
  • Ravexina
    Ravexina over 6 years
    .bashrc doesn't have any effect on .profile being sourced or not, actually it's .profile which sources the .bashrc.