LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   where is the .bashrc file??? (https://www.linuxquestions.org/questions/linux-newbie-8/where-is-the-bashrc-file-178705/)

xenia 05-06-2004 05:28 PM

where is the .bashrc file???
 
where is the .bashrc file???this sentence sums up pretty much all my problems.I' using Slackware 9.1 in my computer.I've recently installes a programm (network simulator 2)and each time I use it I have to set the Paths right from the strat because I can't find the .bashrc file.It has driven me mad!!!Should I create it by myself, where and how do I set the path?

P.S. I'm really new at this and I would appreciate it if someone could tell me some simple steps of what to do

Tinkster 05-06-2004 05:50 PM

Kalimera!

Yep, you should create one yourself.

Slack is minimalistic, Pat doesn't cusotmize things
(or very little) for you. Most packages in slack will
come as if you had built your LFS, no pre-fabed
configurations.


Cheers,
Tink

deloptes 05-06-2004 05:54 PM

If you are new to something than you would be willing to learn - ain't you?!

now cdange into your home directory

Code:

cd ~
than type

Code:

ls -al | grep .bashrc
If you don't find it that way create it right there ...

and redefine your path i.e under bash

Code:

export PATH=<YOUR_PATH>:$PATH
the same you do with your MAN_PATH and so on

!!! BUT CAUTION !!!

putting PATH in your .bashrc will append the PATH each time you run a terminal, so it's better idea to use

.bash_profile, whilch should be also in your home directory

!!! LEARN !!!

the DOT files under linux are hidden (system) files and not visible

regards

fancypiper 05-06-2004 05:59 PM

You should find an example in /etc/skel. Here is an example for one of my users:
Code:

# Duron 950 uilleann .bashrc file for user fancy
# User specific aliases and functions

# Change bash prompt. See the article:
# http://www-106.ibm.com/developerwork.../l-tip-prompt/
export PS1='\d \@ \[\e[32;1m\]\u\[\e[34;1m\]@\[\e[36;1m\]\H \[\e[34;1m\]\w\[\e[32;1m\] $ \[\e[0m\]'
# For the root account use this
# export PS1='\d \@ \[\e[31;1m\]\u\[\e[34;1m\]@\[\e[36;1m\]\H \[\e[34;1m\]\w\[\e[31;1m\] # \[\e[0m\]'

# Set paths
alias path='echo -e ${PATH//:/\\n}'

# Start the screensaver daemon
alias saver='nohup xscreensaver &'

# Allow local users to use my X session
# xhost +local:

# Dialup, start fetchmail daemon and startx
alias x='/sbin/ifup ppp0;fetchmail -d 300;startx'

# Alter the ls command
alias ls='ls -ac'
alias lls='ls -lac'

# Become system administrator
alias god='su -'

# Connect/disconnect the internet by modem
alias dial='/sbin/ifup ppp0'
alias hangup='/sbin/ifdown ppp0'

# Realplayer
alias rp='/pub/home/fancy/RealPlayer8/realplay'
alias r1='/pub/home/fancy/RealPlayer9/realplay'

# Launch links with my linux links page
alias links='links /home/fancy/bookmarks.html'

# Power down/reboot
alias off='shutdown -h now'
alias boot='shutdown -r now'

# For nano editor because I forget which one I use in which distro
alias pico='nano -w'
alias nano='nano -w'

# This script needs to be on the bottom of the file or RH updates will fsck it up
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi


mikshaw 05-06-2004 09:44 PM

Quote:

Originally posted by fancypiper
alias path='echo -e ${PATH//:/\\n}'
holy poop. I spent hours one day trying to create something that would give this result. I don't quite understand what it means, but it works. Thanks.

jschiwal 05-07-2004 01:25 AM

Use the .bash_profile file instead. This file is sourced when you log in. The .bashrc file is sourced every time you start a bash shell.

xenia 05-07-2004 08:32 PM

Thank you all for your quick reply.I did the following:
1)I typed

ls -al | grep .bashrc

into my home directory and I found no .bashrc file.

2)I created myself under the same directory a .bash_profile file
(I used the vi editor to create the file and I saved it as .bash_profile under the home directory.Into the file I only wrote the path by typing

export PATH=/home/...../..../.....:$PATH

isnt't that right??Should I have added something else too??)

3)I rebooted my computer

After doing all these I went to the directory that I have installed the simulator
(I have installed it under the home directory , does this cause any problems??), I opened a terminal and I tried to run the simulator by typing the right order.

The simulator wouldn't run unless I set the PATH in the terminal right from the start as before. Everything I did with the .bash_profile file is ignored and I have to set the path right from the beginning.

What is wrong in all these??

P.S.I' m sorry for being so analytical but I' m completely lost

mikshaw 05-07-2004 09:26 PM

export PATH=/home/...../..../.....:$PATH

The syntax is correct, but the paths themselves may be incorrect...what do you mean by "..../..../...."?
Hoping to make this a little more clear for you, suppose you have a directory within $HOME which you want to add to your $PATH, and this directory is /home/xenia/simulator.
In order to add this path to your $PATH variable, you'd do:
export PATH=/home/xenia/simulator:$PATH or PATH=~/simulator:$PATH or PATH=$HOME/simulator:$PATH
Each path added is separated by a colon.

Also, make sure that the simulator binary is located in the specific path which is added to your $PATH variable...if it's in a subdirectory of that path it won't work.

Rebooting is unnecessary...at most log out and log back in.

deloptes 05-08-2004 12:11 PM

hmm, are you using the x-termina or konsole.

try typing

Code:

echo $PATH
echo $SHELL

or

Code:

export | grep PATH
export | grep SHELL

before running the simulator

this way you'll se if the chages took effect, also you don't have to reboot (my God - those are the bad habits of using windows) . In the worst case it's enough to login under X again but usually it's enough to start another XTerm.

you might have different shell configured as default, also under KDE you must start konsole with the -ls option so that .bash_profile is read (simultates login shell)

Finally it's not hard to write a script that is setting up the path but watch out to have the abbility to extend your path from your login script

regards


All times are GMT -5. The time now is 03:10 PM.