LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-21-2018, 05:36 PM   #1
BudiKusasi
Member
 
Registered: Apr 2017
Posts: 54

Rep: Reputation: Disabled
What's the difference between files .bash_profile and .profile


What's the difference between files:

.bash_profile
.profile

in home user dir ?
with clear explanation.. Thanks much in advance
 
Old 01-21-2018, 07:42 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,762
Blog Entries: 27

Rep: Reputation: 4628Reputation: 4628Reputation: 4628Reputation: 4628Reputation: 4628Reputation: 4628Reputation: 4628Reputation: 4628Reputation: 4628Reputation: 4628Reputation: 4628
What distro are you using? On CentOS and Slackware, there is no file named .profile in ~/.

The .bash_profile file in CentOS checks whether a .bashrc is present. If it is present, it calls ~/.bashrc, which is the traditional place for bash customization; otherwise, the systemwide bash environment from /etc/profile. It also includes a bit of space for customizing your path.

You can use the cat command to look at the contents of the files and answer the question for yourself. Cat is a very use command to be familiar with. You might also take a look at man bash.

Afterthought:

This wouldn't be a homework question, would it?
 
Old 01-21-2018, 07:59 PM   #3
BudiKusasi
Member
 
Registered: Apr 2017
Posts: 54

Original Poster
Rep: Reputation: Disabled
I am actually in Msys (maybe Cygwin also has this extra file .profile)

with content in .bash_profile:

# ~/.bash_profile: executed by bash(1) for login shells


and in .profile:

# ~/.profile: executed by the command interpreter for login shells
 
Old 01-21-2018, 08:07 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,541

Rep: Reputation: 1839Reputation: 1839Reputation: 1839Reputation: 1839Reputation: 1839Reputation: 1839Reputation: 1839Reputation: 1839Reputation: 1839Reputation: 1839Reputation: 1839
https://www.gnu.org/software/bash/ma...tup-Files.html

Quote:
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.
 
Old 01-22-2018, 06:05 AM   #5
YesItsMe
Member
 
Registered: Oct 2014
Distribution: Gentoo (broken)
Posts: 610

Rep: Reputation: 213Reputation: 213Reputation: 213
Unlike .bash_profile, the .profile file was derived from the Unix Bourne shell and it is read by most of the "standard" shells except the csh, so if you're regularly changing your default shell, it might come in handy for you.
 
Old 01-22-2018, 07:24 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,486

Rep: Reputation: 4307Reputation: 4307Reputation: 4307Reputation: 4307Reputation: 4307Reputation: 4307Reputation: 4307Reputation: 4307Reputation: 4307Reputation: 4307Reputation: 4307
yes, see man bash, look for invocation. actually this is almost the same as post #4
 
  


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
.bash_profile vs .profile vicky007aggrwal Linux - Newbie 1 10-04-2012 11:17 AM
Diff between /etc/profile and ~/.bash_profile muazfarooqaslam Linux - Newbie 5 12-27-2007 05:10 PM
Diff between /etc/profile and ~/bash_profile muazfarooqaslam Linux - General 1 12-26-2007 08:28 AM
.profile or .bash_profile user52 Linux - Newbie 8 12-02-2006 12:48 PM
.bash_profile and /etc/profile not sourced? FogSwimmer Ubuntu 7 10-05-2006 06:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:43 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