LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Where can I modify ls command to personalize with my preferred options? (http://www.linuxquestions.org/questions/linux-newbie-8/where-can-i-modify-ls-command-to-personalize-with-my-preferred-options-915481/)

Foxbat1155 11-25-2011 06:39 AM

Where can I modify ls command to personalize with my preferred options?
 
Where can I find the file that I would modify in emacs, for instance, so that when I issue ls on terminal it invokes "ls -alphX" instead of just ls?

Thankyou in advance.

jhwilliams 11-25-2011 06:45 AM

On Ubuntu (by default), you can put custom aliases in a file called ~/.bash_aliases .

In your case, then, you would put:
Code:

alias ls='ls -alphX'
The next time you login to a shell, the change should be active.

BTW, I don't actually recommend changing ls. You could call it something else, like lsa. So:
Code:

alias lsa='ls -alphX'

Foxbat1155 11-25-2011 06:46 AM

Thankyou
 
Thankyou Mister, then should I do source bash after doing this to activate the changes?

Foxbat1155 11-25-2011 06:48 AM

solved
 
Thankyou Mister Williams, apparently it is already working as of writing the alias...

jhwilliams 11-25-2011 06:53 AM

Quote:

Originally Posted by Foxbat1155 (Post 4533579)
Thankyou Mister, then should I do source bash after doing this to activate the changes?

~/.bashrc sources ~/.bash_aliases, so it would work to source either of those files -- eboth end up re-reading the aliases.

Foxbat1155 11-25-2011 06:56 AM

question
 
It says I do not have permission even though I am already root

jhwilliams 11-25-2011 06:58 AM

Quote:

Originally Posted by Foxbat1155 (Post 4533589)
It says I do not have permission even though I am already root

What is the command you are typing to get that message?

Foxbat1155 11-25-2011 07:07 AM

command
 
~/.bashrc sources ~/.bash_aliases

jhwilliams 11-25-2011 07:11 AM

Quote:

Originally Posted by Foxbat1155 (Post 4533595)
~/.bashrc sources ~/.bash_aliases

Oh okay. Yea, I meant that .bashrc includes .bash_aliases, so you can do one of:

Code:

source ~/.bash_aliases
or, alternatively,

Code:

source ~/.bashrc
Sorry for the confusing language.

Foxbat1155 11-25-2011 07:12 AM

thankyou
 
thankyou Sir


All times are GMT -5. The time now is 01:23 AM.