0

I'm trying to identify the files run at login, in order. I'm thinking specifically of files like ~/.*shrc (.bashrc, .tcshrc, etc.), ~/.profile, or /etc/profile.

I'm running on a different system than the ones I'm used to and finding a number of basic behaviors are different (e.g. the Home key on my keyboard now inserts a tilde instead of going to the start of the line, aliases are different, different default shell). So I'm going through the process of learning more about how all the startup scripts work, what settings should be done where, etc. I've done a fair amount of reading on these topics so far, however links to related discussions are very welcome.

EDIT: altered title to accurately reflect the rest of the above text.

2 Answers 2

0

The files executed on startup depend the your environment and command interpreter. You will have to work this out from reading the respective man pages. As an example for bash:

  • determine what SHELL you use. login(1) and getusershell(3) will help you.
  • determine the session type - login/interactive?

when you know these, read the shell's man page and look for it's startup behavior. As an example for bash(1):

INVOCATION The following paragraphs describe how bash executes its startup files. :-)

bash (like most other shells) has a --verbose option. If you want to get fancy, make the login shell execute the shell with it's verbose setting, like

shiny:bin root# cat vbash 
exec /bin/bash -v

and set /bin/vbash as your login shell. It does not even have to be on the whitelist in /etc/shells for it to work...

then, after you have the files, fix your terminal settings...

0

When I need to check the order of execution for each startup file I just add an echo "{filename}" to the top of each startup file. Just replace {filename} with the name of that startup file. When you login that echo command is executed and it prints out the name of the file that was accessed. The /etc/profile is probably root protected, so you may not be able to edit that file.

1
  • But how can I find all the files in the first place? Chicken vs. egg.
    – TTT
    May 14, 2014 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .