LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 12-18-2004, 09:19 PM   #1
soren625
Member
 
Registered: May 2004
Distribution: Fedora Core
Posts: 64

Rep: Reputation: 15
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.

Last edited by soren625; 12-18-2004 at 09:41 PM.
 
Old 12-18-2004, 09:47 PM   #2
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
Post your .bash_profile
 
Old 12-18-2004, 09:50 PM   #3
soren625
Member
 
Registered: May 2004
Distribution: Fedora Core
Posts: 64

Original Poster
Rep: Reputation: 15
# .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

Last edited by soren625; 12-18-2004 at 09:52 PM.
 
Old 12-18-2004, 10:20 PM   #4
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
What happens when you do ls -lh from a terminal?
 
Old 12-18-2004, 10:25 PM   #5
soren625
Member
 
Registered: May 2004
Distribution: Fedora Core
Posts: 64

Original Poster
Rep: Reputation: 15
it prints the way it should: with colums (permissions, size, owner, creator, etc.)
 
Old 12-18-2004, 10:30 PM   #6
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
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!
 
Old 12-19-2004, 01:22 AM   #7
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Quote:
Code:
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
See what's in there relating to ls. Maybe something's clobbering your setting.
 
Old 12-20-2004, 06:10 AM   #8
soren625
Member
 
Registered: May 2004
Distribution: Fedora Core
Posts: 64

Original Poster
Rep: Reputation: 15
All that's in /etc/bashrc regarding ls is the same thing that's in my personal ~/.bashrc:

alias ls='ls -lh'
 
Old 12-20-2004, 11:50 AM   #9
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
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.
 
Old 12-20-2004, 07:30 PM   #10
soren625
Member
 
Registered: May 2004
Distribution: Fedora Core
Posts: 64

Original Poster
Rep: Reputation: 15
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.
 
Old 01-27-2005, 08:59 AM   #11
soren625
Member
 
Registered: May 2004
Distribution: Fedora Core
Posts: 64

Original Poster
Rep: Reputation: 15
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.
 
  


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
Eterm doesn't import aliases from bashrc oldmanofthesea Linux - General 1 05-16-2005 07:17 AM
making aliases - no bashrc file disorderly Linux - Newbie 9 09-27-2004 04:57 PM
adding aliases, refreshing .bashrc NonSumPisces Linux - Newbie 8 06-25-2004 11:39 PM
aliases in .bashrc file davalos Linux - Newbie 7 08-21-2003 01:03 PM
.bashrc aliases Crashed_Again Linux - General 8 01-30-2003 06:42 PM


All times are GMT -5. The time now is 02:59 PM.

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