Depends on the shell. You need to read the man pages of the shell you use; in bash it is .profile and/or .bashrc and/or .bash_login, and it tcsh it is .cshrc and/or .tcshrc and/or .login. Note that these files are not all equivalent, and are executed in different situations. Look at the documentation.
When playing with these files: make sure you have another login that allows you to regain access to the machine if you screw up; if you have a terrible error in these files, it might become impossible to log in. Also make sure that the commands that are used for non-interactive shells are very fast and don't create unnecessary output.