LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 03-25-2010, 04:05 PM   #1
asookazian
LQ Newbie
 
Registered: Mar 2010
Posts: 24

Rep: Reputation: 15
modifying .bashrc and .bash_aliases


I'm fairly new to RHEL and Ubuntu 9.10 and need to know how to do a lot of bash operations. I'm fairly up to speed but I want to create aliases and change the bash prompt, etc. and have that affected for each bash session (i.e. permanent).

So which files do I need to create/modify in RHEL? Is there a separate file for aliases in RHEL? This was fairly straight-forward in Ubuntu.

There is a /etc/bashrc script. Is this one global? I just want to write one or mod one for me (current user, not root or all users).

So I wrote a .bashrc in my home directory and did a 'chmod u+x .bashrc'. When I opened a new bash terminal, my new alias 'l' command is not recognized.

Here is the script:

#!/bin/bash

alias l='ls -la'
 
Old 03-25-2010, 04:22 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Hi, and welcome to LQ!

Have a look at ~/.bashrc and ~/.bash_{profile,login}

Things in ~/.bashrc should usually just "take", and aliases
are commonly in that file, too.

And bashrc doesn't need the shebang line - it's being sourced.

Cheers,
Tink

Last edited by Tinkster; 03-25-2010 at 04:24 PM.
 
1 members found this post helpful.
Old 03-25-2010, 05:26 PM   #3
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
You don't need to make it executable and you have to log out and back in again for bashrc to start working.
 
Old 03-25-2010, 06:12 PM   #4
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 650

Rep: Reputation: 78
you can also type
Code:
source .bashrc
This will load your new .bashrc file. Type in alias to verify your new alias commands are listed
 
Old 03-25-2010, 07:41 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Here's some good bash tutorials
http://rute.2038bug.com/index.html.gz - Linux at the cmd line
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
Old 03-26-2010, 12:51 AM   #6
asookazian
LQ Newbie
 
Registered: Mar 2010
Posts: 24

Original Poster
Rep: Reputation: 15
thanks much for the replies. I got kicked off the Ubuntu/Win7 box and now using WinXP (blame the wife) but I'll give it a try soon.

btw, I'm a Java developer and noticed that Eclipse 3.5 (Galileo) runs much faster on Ubuntu (it's a 2007 Dell with AMD X2 proc, nothing fancy) than on Win boxes.
 
Old 03-26-2010, 08:33 AM   #7
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 650

Rep: Reputation: 78
I think you'll find a lot of things will run a little faster on Linux
 
Old 03-26-2010, 08:36 AM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Quote:
Originally Posted by bret381 View Post
I think you'll find a lot of things will run a little faster on Linux
And way faster if they're not implemented in java ;-)

Evo2.
 
  


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
.bashrc / .bash_profile /etc/profile /etc/bashrc deadeyes Red Hat 2 02-13-2010 12:22 PM
Aliases don't execute after placing them in .bashrc or .bash_aliases in 2.16 ubume2 Puppy 2 08-29-2008 12:41 PM
Setting path: /etc/profile, /etc/bashrc or ~/.bashrc Swakoo Linux - General 1 08-07-2007 11:59 PM
fluxbox doesn't consider bash_aliases Four Linux - Newbie 5 04-26-2007 08:59 PM
modifying $PATH in bashrc gargamel237 Linux - Software 4 08-13-2003 01:10 PM


All times are GMT -5. The time now is 01:08 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration