LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   modifying .bashrc and .bash_aliases (https://www.linuxquestions.org/questions/linux-newbie-8/modifying-bashrc-and-bash_aliases-797862/)

asookazian 03-25-2010 03:05 PM

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'

Tinkster 03-25-2010 03:22 PM

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

smoker 03-25-2010 04:26 PM

You don't need to make it executable and you have to log out and back in again for bashrc to start working.

bret381 03-25-2010 05:12 PM

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

chrism01 03-25-2010 06:41 PM

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/

asookazian 03-25-2010 11:51 PM

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.

bret381 03-26-2010 07:33 AM

I think you'll find a lot of things will run a little faster on Linux

evo2 03-26-2010 07:36 AM

Quote:

Originally Posted by bret381 (Post 3913178)
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.


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