Unix / Linux: Initialize Dot Files Without Restarting The Current Shell Session

I‘m a new Linux, OS X or Unix-like system users. I’m using bash shell. I made changes to my $HOME/.profile ($HOME/.bash_profile) file. How can I restart my session without doing logout and login again?

You can always initialize your shell startup files without restarting a Unix or Linux based session. The command and input file name depends upon your shell you are using. You can use the following command to find out your shell name:[donotprint]
Tutorial details
Difficulty Easy (rss)
Root privileges No
Requirements None
Time 1m


echo $SHELL

Sample outputs:


Restart a Unix/Linux session based on ksh or bash shell

The syntax is:

. $HOME/.profile  
. $HOME/.bash_profile  
## or Use source command ##
source $HOME/.profile  
source $HOME/.bash_profile

The source or . is a shell builtin commands to read and execute commands from given FILENAM. If you have created a $HOME/.bashrc file, type:

. $HOME/.bashrc
## or 
source $HOME/.bashrc

Restart a Unix/Linux session based on csh or tcsh shell

The syntax is as follows for csh/tcsh based shell:

source .cshrc
source .login

For more info see your shell man pages – ksh(1) or type the following command:

help source
help .
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

5 comments… add one
  • oll Jan 12, 2015 @ 7:56

    For (t)csh, you also have to do a rehash if you changed your PATH variable.

  • Anon Jan 12, 2015 @ 13:29

    If you removed an alias or function, it will still be there.

  • Chris F.A. Johnson Jan 12, 2015 @ 19:44

    $SHELL does not necessarily contain the current shell; it contains the default shell (and it should be ‘echo “$SHELL” ‘, not ‘echo $SHELL’).

    You would not want to “source $HOME/.bash_profile” in ksh.

    “help source” is bash syntax not ksh (that would be “source –help”).

    • Anony Apr 27, 2015 @ 18:51


      echo $SHELL returns the user’s default shell
      echo $0 returns the current shell

  • Anon May 24, 2015 @ 7:31

    With bash I usually do “exec bash -il”. I get similar commands exist for other shells.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.