LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-12-2009, 11:10 AM   #1
foampile
Member
 
Registered: Feb 2009
Posts: 50

Rep: Reputation: 15
Question .profile does not get sourced upon login in Fedora


what could be the reason and how can i fix it ? the .profile is in /root and i log in as root. it runs on bash.

[root@xyz ~]# ls -la
total 32
drwxr-x--- 3 root root 4096 Feb 11 16:23 .
drwxr-xr-x 23 root root 4096 Feb 12 11:05 ..
-rw-r--r-- 1 root root 24 Feb 22 2008 .bash_logout
-rw-r--r-- 1 root root 327 Feb 22 2008 .bash_profile
-rw-r--r-- 1 root root 184 Dec 11 2007 .bashrc
-rw-r--r-- 1 root root 11 Feb 11 14:38 .exrc
-rw-r--r-- 1 root root 185 Feb 11 16:18 .profile
drwx------ 2 root root 4096 Feb 11 13:00 .ssh
 
Old 02-12-2009, 12:01 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Linux Mint 18
Posts: 7,809

Rep: Reputation: 294Reputation: 294Reputation: 294
Some distributions use .profile and some use .bashrc. I see that you have both. Maybe fedora is using .bashrc to configure bash at login. Also I would check out .bash_profile

---------------------
Steve Stites
 
Old 02-12-2009, 01:05 PM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,063

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
if you are using bash then the login script bash looks for is .bash_profile.
if you are using sh, csh, tcsh, ... i think they look for .profile.
Code:
echo $SHELL
to know what shell you are using.
_____________

i recommend you dont log in as root so you dont blitz your system.

Last edited by schneidz; 02-12-2009 at 01:06 PM.
 
Old 02-12-2009, 01:07 PM   #4
foampile
Member
 
Registered: Feb 2009
Posts: 50

Original Poster
Rep: Reputation: 15
i wonder why it was necessary to deviate from the decades-long traditional name .profile ? smells microsoft-ish ...
 
Old 02-16-2009, 11:55 AM   #5
bach-fiend
LQ Newbie
 
Registered: Feb 2009
Location: St Paul, Minnesota, USA
Distribution: Redhat Fedora 10; someday planet CCRMA
Posts: 11

Rep: Reputation: 0
What names the startup files have and in what order they are tried is something I have to look up every time I need it. Besides depending on the flavor of shell (Bash, Korn, Bourne, C etc) it can also depend on what you use the shell for. For example is this instance of the shell going to be your login shell? An interactive shell that is NOT the login shell? Just a shell script?

These different situations need (possibly) different things initialized. For example, if you just want to run a shell script as though it were any old unix command, defining functions and aliases is probably overkill. But if you are logging on (or off) you may want to do special things, perhaps for administrative reasons.

Also, these scripts can exist not only in your home directory, but also system-wide in /etc. I found it helpful to put lines like "echo 'this is /etc/bash_profile'" in each file so I know what ones are executed in which order under what circumstances.

Also, the various files can explicitly call ("source") each other, typically from inside an "if" statement that checks whether that file exists.
 
Old 02-16-2009, 12:16 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by jailbait View Post
Some distributions use .profile and some use .bashrc.
Nope. (Reasons below).

Quote:
Originally Posted by bach-fiend View Post
What names the startup files have and in what order they are tried is something I have to look up every time I need it. Besides depending on the flavor of shell (Bash, Korn, Bourne, C etc) it can also depend on what you use the shell for. For example is this instance of the shell going to be your login shell? An interactive shell that is NOT the login shell? Just a shell script?
Yes. Hence, to the original poster I say: read the man page for the shell you are using.

The initialization files do not depend on the distro, but in the shell you use and how you use it (login vs. non login, interactive or not, special parameters passed, etc.), hence. For bash, you should be looking at ~/.bashrc for interactive but non-login shell. If you really mean an interactive login shell then it will first source /etc/profile if it exists, and after that it will source one and only one of ~/.bash_profile, ~/.bash_login, and ~/.profile, only the first one will be used, even if it's empty, so, if ~/.bash_profile is there, ~/.profile will never be read by bash.

That and more is in the bash man page, so read it, specially the section titled "INVOCATION". Other shells will follow different rules, so if you don't use bash, read the man page for your shell.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
login without using .profile shobhit Linux - Software 8 06-02-2007 12:39 PM
.bash_profile and /etc/profile not sourced? FogSwimmer Ubuntu 7 10-05-2006 05:45 AM
Login Profile jonty_11 Linux - General 6 10-28-2004 05:17 PM
about the login profile ust Linux - Software 2 02-02-2004 09:43 PM
.profile .login albean Linux - Newbie 4 10-04-2002 08:51 PM


All times are GMT -5. The time now is 03:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration