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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-18-2004, 09:19 PM
|
#1
|
Member
Registered: May 2004
Distribution: Fedora Core
Posts: 64
Rep:
|
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.
|
|
|
12-18-2004, 09:47 PM
|
#2
|
Gentoo Developer
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Rep:
|
Post your .bash_profile
|
|
|
12-18-2004, 09:50 PM
|
#3
|
Member
Registered: May 2004
Distribution: Fedora Core
Posts: 64
Original Poster
Rep:
|
# .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.
|
|
|
12-18-2004, 10:20 PM
|
#4
|
Gentoo Developer
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Rep:
|
What happens when you do ls -lh from a terminal?
|
|
|
12-18-2004, 10:25 PM
|
#5
|
Member
Registered: May 2004
Distribution: Fedora Core
Posts: 64
Original Poster
Rep:
|
it prints the way it should: with colums (permissions, size, owner, creator, etc.)
|
|
|
12-18-2004, 10:30 PM
|
#6
|
Gentoo Developer
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Rep:
|
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!
|
|
|
12-19-2004, 01:22 AM
|
#7
|
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113
Rep:
|
Quote:
Code:
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
|
See what's in there relating to ls. Maybe something's clobbering your setting.
|
|
|
12-20-2004, 06:10 AM
|
#8
|
Member
Registered: May 2004
Distribution: Fedora Core
Posts: 64
Original Poster
Rep:
|
All that's in /etc/bashrc regarding ls is the same thing that's in my personal ~/.bashrc:
alias ls='ls -lh'
|
|
|
12-20-2004, 11:50 AM
|
#9
|
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113
Rep:
|
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.
|
|
|
12-20-2004, 07:30 PM
|
#10
|
Member
Registered: May 2004
Distribution: Fedora Core
Posts: 64
Original Poster
Rep:
|
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.
|
|
|
01-27-2005, 08:59 AM
|
#11
|
Member
Registered: May 2004
Distribution: Fedora Core
Posts: 64
Original Poster
Rep:
|
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 11:41 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|