Find the answer to your Linux question:
Results 1 to 4 of 4
I was wondering if there is any reason why alias ls='ls -la' does not work? alias dir ='ls -la' works fine. Can't you overwrite ls for some reason? All changes ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User Allblack's Avatar
    Join Date
    May 2003
    Location
    Godzone
    Posts
    416

    ls -la


    I was wondering if there is any reason why

    alias ls='ls -la'

    does not work?

    alias dir ='ls -la'

    works fine.

    Can't you overwrite ls for some reason? All changes where made in ~/.bashrc
    Works fore me on FreeBSD

    cheers
    I am on a journey to mastering Linux and I got a bloody long way to go!!!

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    That certainly works; I assume that it simply is that something else is overwriting it later. Can you post your .bashrc?

  3. #3
    Linux User Allblack's Avatar
    Join Date
    May 2003
    Location
    Godzone
    Posts
    416
    That was it for sure. i got confused because of the order of commenting.
    You can see below what I did at first.

    # .bashrc

    # User specific aliases and functions
    alias ls='ls -a'
    alias dir='ls -la'
    # Source global definitions
    if [ -f /etc/bashrc ]; then
    . /etc/bashrc
    fi
    I am on a journey to mastering Linux and I got a bloody long way to go!!!

  4. #4
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    It looks like you are using Mandrake or Redhat Linux because your .bashrc file looks like mine and I'm using Mandrake 8.2 Anyway, the default Mandrake sets up an alias for ls somewhere in one of the startup scripts, probably in /etc/bashrc. The default is something like
    alias ls='ls -F --color'

    If you move those alias lines in your .bashrc script to the end of the file, after it loads the /etc/bashrc, it should work.

    Actually you might prefer this:
    alias ls='ls -laF --color'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •