LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 03-07-2007, 09:54 AM   #1
Randle2I
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
.bashrc & startup questions


n00b to Linux here & it's starting to piss me off. I've set up my first linux machine using Slackware 10.1 and I'm trying to create some aliases so that I don't always have to type out commands. I'm aware of the tab autocomplete feature but would like to rename some of the more inane commands. Doing some research I found I have to edit the .bashrc file, but I couldn't find it. I was told I can just create it so I did so as well as making a .bash_profile (I did find a .bash_history in the root folder so that's where I placed the two created files). Still nothing. I got to the point where I get a "-bash: source~/.bashrc: No such filer or directory" error upon first log in, but that's as far as I've gotten. What am I doing wrong.

Also I would like to reduce the amount of time spent waiting for Linux to boot up. The timeout is set to two minutes & I can't seem to change that either. I thought it was in the lilo.conf, but editing that did nothing. Any help there would also be appreciated.
 
Old 03-07-2007, 10:01 AM   #2
gibson79
Member
 
Registered: Feb 2007
Distribution: Slackware
Posts: 40

Rep: Reputation: 15
I've been able to set system wide aliases by editing the profile file in /etc and just adding the aliases to the end of that file.

Hope this helps.
 
Old 03-07-2007, 10:02 AM   #3
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 46
Quote:
Originally Posted by Randle2I
I got to the point where I get a "-bash: source~/.bashrc: No such filer or directory" error upon first log in, but that's as far as I've gotten. What am I doing wrong.
You're missing a space:

source ~/.bashrc

bash reads /etc/profile upon login and then .bashrc for the subsequent (i.e. non-login shells). If you want the .bashrc to get read on login also (which in this case is what you want), add the above line to the end of /etc/profile. You don't need .bash_profile file under your home directory. For more information see the manpage of bash (man bash).

Quote:
Also I would like to reduce the amount of time spent waiting for Linux to boot up. The timeout is set to two minutes & I can't seem to change that either. I thought it was in the lilo.conf, but editing that did nothing. Any help there would also be appreciated.
This is done in /etc/lilo.conf. There is variable called TIMEOUT. You can reduce the value of this variable to shorten the waitingtime (50 would wait 5 seconds). After editing lilo.conf you will need to run lilo (be root and enter command 'lilo' on the commandline).

--edit--

You can also add aliases to /etc/profile, but then they won't work in xterms and such...

Last edited by alienDog; 03-07-2007 at 10:04 AM.
 
Old 03-07-2007, 10:33 AM   #4
Randle2I
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the help, finally got it working. On to the next project.
 
Old 03-08-2007, 12:43 AM   #5
rkrishna
Member
 
Registered: Mar 2005
Location: chennai(madras), India
Distribution: slackware ofcourse
Posts: 654

Rep: Reputation: 32
i think there is no bashrc in slack instead we use /etc/profile
 
Old 03-08-2007, 05:05 AM   #6
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,210

Rep: Reputation: 292Reputation: 292Reputation: 292
But system does read ~/.bash_profile so it's usual to put the command to source ~/.bashrc there.

If you only want .bashrc for aliases you could just make an ~/.aliases file instead and put the command

source .aliases ( or '. .aliases' ) in your ~/.bash_profile ( . = source)
 
Old 03-08-2007, 09:15 AM   #7
pdw_hu
Member
 
Registered: Nov 2005
Location: Budapest, Hungary
Distribution: Slackware, Gentoo
Posts: 346

Rep: Reputation: Disabled
Alternatively you can symlink .bash_profile to .bashrc.
 
Old 03-08-2007, 02:16 PM   #8
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Rep: Reputation: 49
if exists, Slack uses them, ie ~/.bashrc and ~/bash_profile

Here's enclosed next, my (I'm al, user al) ~/.bashrc and ~/bash_profile


al@p3srv:~$ cat .bashrc
# 3-10-2005 user al bash settings

# System wide aliases and functions /etc/bashrc (/etc/profile.d).
# Personal startup programs should go into ~/.bash_profile.
# Personal aliases and functions and environment
# variables should go into ~/.bashrc

# next 2 lines - if file exist then source the file
[ -f /home/al/.term_aliases ] && . /home/al/.term_aliases
[ -f /etc/profile ] && . /etc/profile

export PATH=$PATH:/home/al/bin
biff n
alias cdr='sudo /home/al/bin/cdrecordeasy'
alias cmx='chmod u+x'
alias cups='sudo /usr/local/bin/cups.sh'
alias diskck='du -s -k -c * | sort -rn'
alias ethrl='sudo /usr/bin/ethereal'
alias firew='sudo /usr/local/bin/firehol'
alias hi='history'
# <snipped more aliases and a function>



al@p3srv:~$ cat .bash_profile
# 3-10-2005 user al bash settings

# System wide aliases and functions /etc/bashrc (/etc/profile.d).
# Personal startup programs should go into ~/.bash_profile.
# Personal aliases and functions and environment
# variables should go into ~/.bashrc

# next 2 lines - if file exists then source the file
[ -f /etc/profile ] && . /etc/profile

[ -f ~/.bashrc ] && . ~/.bashrc
# end


--
Alan.
 
Old 03-08-2007, 02:18 PM   #9
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Rep: Reputation: 49
if exists, Slack uses them, ie ~/.bashrc and ~/bash_profile

that should be ~/.bash_profile

(with a .)

there is no ~/bash_profile

(without a .)

--
Alan.
 
Old 03-09-2007, 12:28 AM   #10
rkrishna
Member
 
Registered: Mar 2005
Location: chennai(madras), India
Distribution: slackware ofcourse
Posts: 654

Rep: Reputation: 32
Quote:
But system does read ~/.bash_profile so it's usual to put the command to source ~/.bashrc there.
thank you friends, for that info

but i am confused
1.if slack check for .profile file why we are creating a new one .bashrc
2.if so which one if preferred, ie if both .bashrc and .profile is present which one bash will choose?
 
Old 03-09-2007, 12:41 AM   #11
XGizzmo
Member
 
Registered: Mar 2007
Distribution: Slackware
Posts: 264

Rep: Reputation: 68
~/.bash_profile is used by the login shells. (shells you have to type the user and password)
~/.bashrc is used by non login shells. like xterm
 
  


Reply


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
$ gedit.bashrc &-"COMMAND NOT FOUND" aabhardadhich Linux - Software 4 03-01-2007 05:31 AM
Questions about .bashrc and .profile ICO Suse/Novell 1 08-08-2006 10:47 PM
aterm .Xdefaults & .bashrc jipe Linux - Software 8 10-30-2004 09:19 AM
bash env vars alias's & .bashrc micxz Linux - General 8 10-08-2003 02:09 PM
bash_profile & bashrc c1p3r Linux - Newbie 0 07-15-2003 05:10 AM


All times are GMT -5. The time now is 10:25 AM.

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