bashrc Aliases don't work
i am trying to set up two aliases:
alias ls='ls -lh' alias df='df -h' these lines are in my .bashrc in my user directory as well as in the global /etc/bashrc, they both work for root, but not for a common user. (And, yes, I did restart the terminal after making the changes--it still doesn't work). Seems like it should be an easy fix, I just can't find the answer anywhere else! Thanks! (Edit...) Here's something strange: the df alias does work, just the ls doesn't. I know the syntax is correct, because it's identical to the syntax in root's bashrc and that works for root. |
Post your .bash_profile
|
# .bash_profile
# Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH unset USERNAME ***************************************************************************************** #.bashrc # User specific aliases and functions alias ls='ls -lh' alias df='df -h' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi |
What happens when you do ls -lh from a terminal?
|
it prints the way it should: with colums (permissions, size, owner, creator, etc.)
|
Here's something strange: the df alias does work, just the ls doesn't. I know the syntax is correct, because it's identical to the syntax in root's bashrc and that works for root.
Seems strange to me also! |
Quote:
|
All that's in /etc/bashrc regarding ls is the same thing that's in my personal ~/.bashrc:
alias ls='ls -lh' |
Hm. Works for root. Works when issued directly. Not being clobbered. I'm stumped. 'Strange to me also'
Try putting alias ls='echo hi' alias foo='ls -lh' in your .bashrc and run them. Then put it back the way you had it. If you get 'hi' and an '-lh' listing, then I'm completely stumped. If you don't get a 'hi' but do get an '-lh' listing, then something somewhere in the chain of bash invocation is messing something up and I'd check every file in the chain. If you get a 'hi' and no '-lh' listing, then something inexplicable is goofed up with your ls command. |
yeah, that didn't work.
I put those lines in ~/.bashrc and reset. No good. 'foo' gives me a "bad command" type of error. and 'ls' is just plain old ls. oh well thanks for your help. |
I still haven't actualy solved this problem, but I did discover the ll command (short for "Long List," I guess). It provides the functionality I wanted right out of the box.
Thanks to those who gave their insights, though. |
All times are GMT -5. The time now is 04:40 PM. |