.bashrc file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting .bashrc file
# 1  
Old 10-28-2009
.bashrc file

Hi experts,

I am using bash shell and I cant find any .bashrc file in my home dir. Can anybody please help me out here....

If .bashrc file is not there, from where my shell config operates? Also I want to set my prompt like...

Code:
[server:working_dir]$

Please advice.
gentleDean
# 2  
Old 10-28-2009
There must be a system-wide .bashrc somewhere (may be in /etc) that will server as default bashrc if not present in your home directory.

For your prompt, add this line in the .bashrc from your home directory:
Code:
PS1='[\h:\w]$ '

# 3  
Old 10-28-2009
To add this code in .bashrc file, I need to create it first...
can you please show me how can I create it? format?
gentleDean
# 4  
Old 10-28-2009
Code:
echo 'PS1=\'[\h:\w]$ \'' > .bashrc

Or just:
Code:
<favourite editor> .bashrc

then type what you wish in there
# 5  
Old 10-28-2009
Hi.

On Linux systems there are files often used as sources for new account (login) creations. On the system:
Code:
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution        : Debian GNU/Linux 5.0

the .bashrc file is at:
Code:
/etc/skel/.bashrc

It's about 100 lines and should be a good start.

Best wishes ... cheers, drl
# 6  
Old 10-28-2009
Quote:
Originally Posted by gentleDean
I am using bash shell and I cant find any .bashrc file in my home dir. Can anybody please help me out here....

man bash:
Code:
       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.

       When an interactive shell that is not a login shell is started,
       bash reads and executes commands from ~/.bashrc, if that file
       exists. This may be inhibited by using the --norc option. The
       --rcfile file option will force bash to read and execute
       commands from file instead of ~/.bashrc.



---------- Post updated at 04:29 PM ---------- Previous update was at 04:23 PM ----------

Quote:
Originally Posted by drl
On Linux systems there are files often used as sources for new account (login) creations. On the system:
Code:
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution        : Debian GNU/Linux 5.0

the .bashrc file is at:
Code:
/etc/skel/.bashrc

It's about 100 lines and should be a good start.

100 lines is excessive. On mine (Mandriva), there are three uncommented, non-empty lines.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. OS X (Apple)

A system deletes my .bashrc file

It deletes my .bashrc file rarely but predictability after some unknown count of Mac's restarts. Has someone ever faced such behavior? How do I prevent OS X from modifying .bashrc? What ownership/permission should I set up to not let it happen? OS X Lion. (6 Replies)
Discussion started by: scrutinizerix
6 Replies

2. UNIX for Dummies Questions & Answers

Bashrc File - Conditional Command Execution?

Hello All, I was wondering if there is a way to execute a command in my ".bashrc" file based on how I logged into the PC? I was thinking maybe there is a way to check how the user (*myself) logged in, maybe somehow with the who command along with something else, but I'm not sure... I know I... (7 Replies)
Discussion started by: mrm5102
7 Replies

3. Shell Programming and Scripting

Modifying the .bashrc

I have modified the .bashrc. The problem is that when I write a long command, it does not write on the next line but continues to write on the same line. # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for... (1 Reply)
Discussion started by: kristinu
1 Replies

4. Shell Programming and Scripting

bashrc not saving changes

I am trying to do some changes at bashrc file located at /etc directory of my server. First I tried to edit bashrc via FTP downloaded on my pc changed it and loaded back, but it seems like changes are not reflecting. Therefore I tried to change it via putty shel using vim bashrc command. but... (4 Replies)
Discussion started by: ninadgac
4 Replies

5. Shell Programming and Scripting

bashrc

i have made a few changes to my bashrc file...have set a few environmental variable that my shell scripts use. Is there any way that these changes can reflect in evryone else's bashrc who are in the network or do all of them have to copy those changes to their own bashrc file. (2 Replies)
Discussion started by: lassimanji
2 Replies

6. Shell Programming and Scripting

how do i look for my .bashrc file

hi i am using cygwin and would like to modify my .bashrc file. How can search to find where it is? I have looked at multiple bashrc file in /etc but none of them seemed to work..thanks (12 Replies)
Discussion started by: npatwardhan
12 Replies

7. Shell Programming and Scripting

Can I modify the .bashrc file instead of .profile file to customize my login?

Hello, I got this question which tells me to customize my login script. Some people in the forums suggested to modify the .profile file in my home directory. I did so, but none of my customizations show up when I open the terminal after. So, I tried to modify other files in my home directory,... (1 Reply)
Discussion started by: Hyunkel
1 Replies

8. UNIX for Dummies Questions & Answers

.bashrc file is an initialization file run by each interactive invocation

I search the web and found the following statements ..... The /etc/profile file is a system wide initialization script which is run at login time for each user, while .profile is the users own login initialization. The .bashrc file is an initialization file run by each interactive invocation... (1 Reply)
Discussion started by: cy163
1 Replies

9. Shell Programming and Scripting

from bashrc to sh..??

:) as soon as i installed my software a couple of weeks ago.. (fedora core 2 vs, 2.6.8-1.521) i decided to switch the shell to sh shell and i know that .bashrc is the bash profile file(???) i want to use the sh version of the same file and make it the main profile file.. how can I switch it and... (3 Replies)
Discussion started by: moxxx68
3 Replies
Login or Register to Ask a Question