Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-12-2010, 12:55 PM   #1
Registered: Aug 2010
Posts: 103

Rep: Reputation: 5
how to create /.bashrc

hello y'all. i would like to know how to create /.bashrc in my home directory? do i make a folder naming it /.bashrc or i make its as a file? would really be grateful for your help thanks again.
Old 11-12-2010, 12:57 PM   #2
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Just create a file
in your homedirectory

Kind regards
Old 11-12-2010, 12:58 PM   #3
LQ Newbie
Registered: Oct 2010
Posts: 25

Rep: Reputation: -14
if youve got "midnight commander" try(mc)on the command line just get to know it youll soon work out how to ,erase, edit or replace bashrc

----------oh yeah,you know you can only have one of these type of file on you system-------

Last edited by Davethesnake; 11-12-2010 at 12:59 PM.
0 members found this post helpful.
Old 11-12-2010, 01:11 PM   #4
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 553Reputation: 553Reputation: 553Reputation: 553Reputation: 553Reputation: 553
To expand upon post #2 a little bit: there are a few ways to simply "create a file":
shell$ touch ~/.bashrc

shell$ echo > ~/.bashrc # warning: this will ERASE a pre-existing file and make an empty one!
if you're in a terminal, you could use a text editor like nano:
shell$ nano ~/.bashrc
That opens up the file in the nano editor. You can put commands in there, and save the file by pressing CTRL-o, ENTER, and exit nano by pressing CTRL-x.
Old 11-12-2010, 04:00 PM   #5
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
Why do you feel the need to create one ?
Don't you already have one ?

I'm also a bit worried about your use of /.bashrc

That is actually creating a .bashrc file in the root directory.
Not the home directory of root, the actual / root directory, where no user will ever access it.

Is this what you intended ?

Last edited by smoker; 11-12-2010 at 04:03 PM.
Old 11-12-2010, 04:53 PM   #6
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,504
Blog Entries: 32

Rep: Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675

You could setup a .bashrc & .bash_profile for your user in their home (~) directory;
sample .bash_profile;  
~$ cat .bash_profile
 # .bash_profile
 #08-30-06 12:21
 # Source .bashrc
 if [ -f ~/.bashrc ]; then
         . ~/.bashrc
 sample .bashrc;
 :~$ cat .bashrc
 #08-30-06 12:20  
# Add bin to path

 export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"

 #export PATH="$PATH:$HOME/bin"

 # Dynamic resizing
 shopt -s checkwinsize

 # Custom prompt
 #PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

 #08-29-06 11:40

 if [ `id -un` = root ]; then
    PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '
    PS1='\[\033[1;32m\]\h:\w\$\[\033[0m\] '

 # Add color
 eval `dircolors -b`

 # User defined aliases
 alias cls='clear'
 alias clls='clear; ls'
 alias ll='ls -l'
 alias lsa='ls -A'
 alias lsg='ls | grep'
 alias lsp='ls -1 /var/log/packages/ > package-list'
 alias na='nano'
 alias web='links -g -download-dir ~/'

 #08-29-06 11:50

 #To clean up and cover your tracks once you log off
 #Depending on your version of BASH, you might have to use
 # the other form of this command
    trap "rm -f ~$LOGNAME/.bash_history" 0

 #The older KSH-style form
 #   trap 0 rm -f ~$LOGNAME/.bash_history
The .bashrc is very useful!
Just a few links to aid you to gaining some understanding;

1 Linux Documentation Project
2 Rute Tutorial & Exposition
3 Linux Command Guide
4 Bash Beginners Guide
5 Bash Reference Manual
6 Advanced Bash-Scripting Guide
7 Linux Newbie Admin Guide
8 LinuxSelfHelp
9 Getting Started with Linux
The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!


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
.bashrc / .bash_profile /etc/profile /etc/bashrc deadeyes Red Hat 2 02-13-2010 12:22 PM
create a variable in the .bashrc file in my home directory coldbeerz Linux - Newbie 2 12-14-2007 10:48 AM
Setting path: /etc/profile, /etc/bashrc or ~/.bashrc Swakoo Linux - General 1 08-07-2007 11:59 PM
bashrc ovince Programming 1 04-24-2007 03:27 AM
bashrc ?? slackb0t Slackware 26 12-04-2006 02:37 PM > Forums > Linux Forums > Linux - Newbie

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

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