LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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

Reply
 
Search this Thread
Old 02-04-2008, 08:04 AM   #1
philwynk
Member
 
Registered: Sep 2007
Posts: 84

Rep: Reputation: 15
Hyperactive alias overrides all command line flags.


Simple question:

I've aliased "ls" to "ls -altr". I like that display.

Only, now that I've done that, "ls" ignores command line switches, and ALWAYS gives me "ls -altr". I should be able to type "ls -alt" and get the display in the reverse order, or "ls -lr" and not see the "." and ".." entries; but for some reason, now that I've aliased "ls", I get the same display no matter what switches I type.

Any idea why it's doing that? Any suggestion how to get it to stop, aside from removing the alias and typing the entire command every time?

Thanks.

Phil W.
 
Old 02-04-2008, 08:43 AM   #2
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
It does that because every time you type "ls" the computer expands this to "ls -altr" so when you type "ls -lr" it is actually "ls -altr -lr" get it? It's like a macro.

That is also why your ~/.bashrc file has different alias names for different effects.
So, alias ls to whatever you use practically all the time, then add other aliases for what you use less often.

lt = ls -alt
lr = ls -lr
 
Old 02-04-2008, 08:59 AM   #3
philwynk
Member
 
Registered: Sep 2007
Posts: 84

Original Poster
Rep: Reputation: 15
Duh... thanks.
 
Old 02-04-2008, 07:04 PM   #4
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
No problem - we all get to ask dumb questions sometimes: have a look at my early posts

The effect is general. Now you have asked, and received this wisdom, you know in your bones a useful paradigm. You are now a little bit smarter. Have fun.

"Remember children, there are no stupid questions, only stupid people."
-- Mr Garretson: South Park.
 
  


Reply

Tags
alias, ls


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
xine command line? or some other command line only engine? lumix Linux - Software 2 08-10-2007 10:46 AM
Use for the alias command Metablade Linux - Newbie 4 10-12-2005 05:44 PM
alias command line arguements Henster Linux - Newbie 2 07-01-2005 03:40 AM
Adding Network Interface alias from command line WireLine Fedora 2 06-08-2005 11:08 PM
Lost alias line in modules.conf RebootKid Linux - Hardware 5 02-20-2003 05:48 PM


All times are GMT -5. The time now is 08:45 PM.

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