Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-18-2010, 11:23 AM   #1
Registered: Jan 2010
Posts: 52

Rep: Reputation: 15
How to add new alias

I was trying to add new alias "alias ls='ls --color=auto'" in .profile, but it never worked

I displayed all the alias that are current available and did not see the one I just added and found this among them:

and the LS_OPTIONS is "-N --color=none -T 0"

this is in /etc/csh.cshrc file which I do not have permission to edit.

Is there way to overwrite it?

Also I do not see a .cshrc under my home directory. Can I just make one and source it? Or do I have to link it to some source file that already exists?
Old 02-18-2010, 11:34 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
If you add something to a config file, you would typically have to either reboot or at least restart X for it to take effect.
Old 02-18-2010, 11:39 AM   #3
Registered: Jan 2010
Posts: 52

Original Poster
Rep: Reputation: 15
Originally Posted by pixellany View Post
If you add something to a config file, you would typically have to either reboot or at least restart X for it to take effect.
But I added something else to the .profile, like:
module load intel

It takes effect right away after I source .profile.
Old 02-18-2010, 11:47 AM   #4
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
I'm not familiar with csh shell, but with Bash for example, when you add something to .bashrc or any other such file that your shell reads, the effect will be there as of the next time you start that shell, either by opening a terminal, or whatever.
When adding something like an alias to the /etc/profile file, it will only be in effect after you source that file, OR it will be in effect system-wide, after the next reboot (or perhaps going to init 1 and back to init 2/3/4/5 will work also).

When adding stuff to the dot-files in your $HOME directory, it will only work if you're sure that your shell actually READS those files when it is invoked.

For example, Bash reads .bashrc and maybe .bash_profile when it is invoked; therefore, if I were to create a file called .profile in my $HOME, I would need to make sure that either .bashrc or /etc/profile had a line that sources my personal .profile file.
The same idea applies with csh or any shell: if you add things, like aliases, to some file such as ~/.profile, you need to make sure that when csh is invoked, *something* is telling it to read your .profile file, so your additions will be read.

Hope this helps a bit.

PS - it may differ for your system, but on my Slackware system, the alias for `ls` is in /etc/profile, so it becomes active for all users, as soon as the machine is booted up.



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
How can i add few arguments at "alias"? DoME69 Programming 5 01-07-2009 06:11 AM
Ndiswrapper Error:couldn't add module alias: at /usr/sbin/ndiswrapper-1.9 line 717. Skuggi Linux - Wireless Networking 1 06-07-2007 11:57 AM
Add Second Gateway for Alias ETH0 linchat Linux - Networking 2 01-06-2006 04:10 PM
Create alias or add to $PATH ryedunn Linux - Newbie 3 08-18-2004 10:42 AM
add an alias gubak Linux - Networking 3 08-12-2004 02:05 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration