create aliases in .cshrc

Discussion in 'macOS' started by tylerc083, May 30, 2005.

  1. tylerc083 macrumors newbie

    Mar 27, 2005
    i'm trying to create a few aliases in a .cshrc file. I did this on a mac i had a few years ago, but have forgotten how to do it.

    I've scoured the net, and everything just says 'open your .cshrc file in your home directory and then...'

    that is my trouble i am thinking. i've opened the terminal app, which by default puts me in my home directory, right? there isn't a .cshrc file, so i used pico to create one. i put in a line like this:
    alias dir ls -al

    i saves and closed pico. closed the terminal app, and reopened, yet dir is unrecognized.

    any ideas as to what i am doing wrong?

  2. mrljt macrumors newbie

    May 30, 2005
    .cshrc is only read if your default shell is csh or tcsh. If you're using a recent version of Mac OS X, then your default shell is most likely bash which does not read .cshrc upon login. To add aliases to bash, edit .profile in your home directory or edit /etc/profile to add the dir alias to all users and add:
    alias dir='ls -la'
    bash uses a different syntax to define aliases than csh. Read the man pages on bash ('man bash' from Terminal) for more info on aliases.
  3. tylerc083 thread starter macrumors newbie

    Mar 27, 2005

Share This Page