Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to find out which profile my shell is currently using? I can't seem to track it down, or at least it's not in any of the usual places. I'm using OS X, but I assume that it would be the same on all UNIX systems.

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Asuming it is bash I assume it using the normal profile files in your home directory and the /etc. See this question which answer mostly points to the invocation section of man bash"

   When  bash  is invoked as an interactive login shell, or as a non-interactive shell with the --login
   option, it first reads and executes commands from the file /etc/profile, if that file exists.  After
   reading  that  file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and
   reads and executes commands from the first one that exists and is readable.  The --noprofile  option
   may be used when the shell is started to inhibit this behavior.

Update:
So you are using zsh: man zsh section STARTUP/SHUTDOWN FILES. Basically it will use the .zsomething files that are mentioned and look in $ZDOTDIR , if that is not set than $HOME. The files in summary:

   $ZDOTDIR/.zshenv
   $ZDOTDIR/.zprofile
   $ZDOTDIR/.zshrc
   $ZDOTDIR/.zlogin
   $ZDOTDIR/.zlogout
   ${TMPPREFIX}*   (default is /tmp/zsh*)
   /etc/zsh/zshenv
   /etc/zsh/zprofile
   /etc/zsh/zshrc
   /etc/zsh/zlogin
   /etc/zsh/zlogout
share|improve this answer
    
Nope, I'm actually using zsh and I've moved my profiles out of my home directory in an effort to find the one that is being used but no luck, I'm wondering if there is a command that will print out all the profiles that have been loaded. –  Joseph Silvashy Feb 5 '10 at 19:24
    
Updated for zsh, my interactive shell of choice :-) –  Kyle Brandt Feb 5 '10 at 19:29
    
I think one thing is that I shouldn't have installed zsh with Mac Ports, I hate where it puts everything. –  Joseph Silvashy Feb 5 '10 at 21:56
add comment

Do you have any files named the same as a zsh profile file but with a .zwc extension?

Those are compiled and, if newer, will be run instead of the plain text version.

share|improve this answer
2  
Compiled configuration files, the feature creep of zsh was a bit bothersome to my unix sensibilities, but I let pass... but compiled configuration files?! OUTRAGEOUS! –  Kyle Brandt Feb 5 '10 at 20:33
add comment

Check the man page or use strings(1) on the executable (or both) to look for all the possibilities, and look for the ones that exist on your system. Note that one .profile may call another file, so you might have to inspect each of the files.

Check the last access time also; a profile file may not be accessed on every startup, or if a different file exists, etc. Depends (obviously) completely on your particular shell.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.