I'm getting into bash shell scripting with Ubuntu 8.10, and the tutorial I'm using is telling me to open the file .bash_profile which is allegedly in the home directory. However, I cannot find this file, except in /usr/share/doc/adduser/examples/adduser.local.config.examples/skel and it's called "dot.bash_profile". Plus, the whole thing is just comments.
The other file it tells me to get to is .bashrc, which I searched the entire system for, and got four files: two named bash.bashrc and two named dot.bashrc. I'm not sure which I want to add
Could someone clarify this whole situation? Thanks.

Recommended Answers

All 4 Replies

Copy the example dot.bash_profile to your home directory as .bash_profile

Then start uncommenting the bits you would like, and adding any new things you would like.

The problem is that the file doesn't have any commands in it. It just says this:

#########################################################################
#         .bash_profile: Personal initialisation file for bash          #
#########################################################################

# This script file is executed by bash(1) for login shells.  By default,
# it does nothing, as ~/.bashrc is already sourced by /etc/profile.
#
# [JNZ] Modified 23-Sep-2004
#
# Written by John Zaitseff and released into the public domain.

I looked for ~/.bashrc, but couldn't find it. I looked for /etc/profile, and the only thing like it (/etc/profile.d) had nothing in it. I also searched for "bash(1)", yielding no results.

Just put
ls
in there for now.

It's not magic, it's just a list of commands you want done every time you either login or create a new shell.

Whenever you log-in or open a new terminal window that starts the shell to run, a series of scripts are executed to establish the environment in which it is to run. These scripts contains commands just like if you were to execute them in the command line.

~/.bash_profile and ~/.bashrc are two of theses scripts that will allow a user to set up a personal environment, if they are present. If not present, not big deal, the global settings kick in. Those are found in /etc, which a regular user may or may not have access to view.
/etc/profile is the first script run by the shell.

e.g.
I like to interact with the shell using keystroke like the editor vi behaves and not like emacs, which is the default setting. Therefore I have this line in my ~/.bashrc file

set -o vi
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.