When you logon a Linux server, there must be couples of things that you have to do everyday, e.g. change to your project directory, check disk space, or check the server load. Of course you can create some shortcuts and alias in your .bashrc file, but you still need to manual execute your shortcut command and I am too lazy to even execute that command.

Well you can solve this problem by modifying your profile file.

If you want to execute some scripts globally for all the users, you can then create a .sh script under /etc/profile.d folder, e.g. updating server proxy for all the users.

Note: the file has to be ended with .sh suffix.

If you just want to do that for some specific user, you can then create a .profile in /home/<user>/ directory, like

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[airflow@localhost ~]$ cat .profile
echo;
echo "Welcome back `whoami` user on `date`!";
echo;
echo "Now redirect to the AIRFLOW_HOME($AIRFLOW_HOME) directory...";
cd $AIRFLOW_HOME; pwd; ls -lrnh;
echo;
echo "Have fun!";
echo;
[airflow@localhost ~]$

Then you have to modify your .bash_profile file to apply your setting.

1
2
3
4
# user specific setting
if [ -f ~/.profile ]; then
        . ~/.profile
fi

Note: Remember to source your .bash_profile as well before logout your user. :P

Next time when you logon the user, you should see the difference!