LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ~/.bashrc, ~/.bash_profile (https://www.linuxquestions.org/questions/linux-newbie-8/%7E-bashrc-%7E-bash_profile-218469/)

Sinope 08-16-2004 05:26 PM

~/.bashrc, ~/.bash_profile
 
I keep finding suggestions to put things in my .bashrc or .bash_profile files, located conveniently in my home directory. Problem is, neither of them are there.

And yes, I did ls -a, I'm not THAT much of a newbie.... I've got .bash_history, and .kderc, and other such goodies, but not those two bash config files.

Is this an oddity of Slackware (ie they are stored somewhere else) or do they simply not exist until I create them? If I do create them, what should they contain? Are they shell scripts? Do I make them executable?

Thanks for any help!

gunter 08-16-2004 05:32 PM

You can simply create them. They are not shell scripts and they do not have to be executable.

Here are mine from a server at work:

[#####@asahel #####]$ cat .bashrc
# .bashrc

# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
[#####@asahel #####]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
CVSROOT=/usr/local/cvsroot/#####

export CVSROOT
export PATH
unset USERNAME

Sinope 08-16-2004 05:36 PM

Excellent! Thanks!

Sinope 08-16-2004 05:43 PM

A thought.... something I'd like to put in there but I'm not quite sure how....

Currently my command line looks like this:

sinope@chaos:~$

Argh! Too much information, I know who I am and what host I'm on, since there's only one user and one host! All I want to see is

$

or perhaps

~$

How do I set that up? Thanks again....

Demonbane 08-16-2004 06:41 PM

export PS1='\w\$'

btmiller 08-16-2004 10:17 PM

Also, if running slackware, beware that by default new users are often given /bin/sh for their shell instead of /bin/bash. /bin/sh is just a symlink to /bin/bash (or vice versa), but if bash is invoked as sh it will behave slightly differently, including not reading the .bash_* startup files. You should chsh your shell to bash. I always do when running slackware. The syntax is chsh -s /bin/bash. You can see how bash has been invoked by typing echo $SHELL on the command prompt (to see if this in necessary).

Sinope 08-17-2004 02:40 AM

Thanks Demonbane. btmiller: thanks, that took me forever to figure out, but I already did that.


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