Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I set ls so that when I type ls it actually runs ls -l. This Sounds minor but I'm trying to save keystrokes wherever I can. This is on Ubuntu 10.10.

share|improve this question

migrated from stackoverflow.com Mar 29 '11 at 2:02

This question came from our site for professional and enthusiast programmers.

add comment

4 Answers

Look up the alias command.

alias list='ls -l'

If you want this to "stick" add it to your .bashrc file.

share|improve this answer
    
As mentioned in another answer, you can also create an alias called ls, to "replace" the regular ls shell built-in. –  oKtosiTe Mar 29 '11 at 10:22
    
Thanks, I was just making it explicit that you could rename the shortcut. –  Andrew White Mar 29 '11 at 11:58
    
Thanks! Works great...I went with alias l="ls -l" and commented out the previous "l" alias in the .bashrc file. –  user73919 Mar 30 '11 at 17:57
add comment

The normal pattern is to have ll aliased to this.

In Ubuntu 10 it is already done.

Here is an extract from the default .bashrc:

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

My .bashrc looks like this:

alias   l='ls --color=always -F'
alias  ll='ls --color=always -F -lh'
alias   L='ls --color=always -F     -L'
alias  LL='ls --color=always -F -lh -L'
alias  la='ls --color=always -F        -a'
alias lla='ls --color=always -F -lh    -a'
alias  l.='ls --color=always -F        -A --ignore=\*'
alias ll.='ls --color=always -F -lh    -A --ignore=\*'

Note: changing the meaning of an existing command is considered dangerous, e.g., alias ls='ls -l'. It can change the behavior of (badly written, though most) scripts.

share|improve this answer
add comment

You can use the alias command.

alias ls="ls -l"

You can either type this out in a shell session, or you can put it in a file to be sourced, a good one would be ~/.bashrc. If you run it in a shell session, the alias will exist until you exit the shell. If you put it in your a file and source it each time the shell is run (such as by simply putting it in ~/.bashrc), the alias will be created each time you open a shell.

share|improve this answer
    
Care to explain the downvote? –  Wuffers Mar 29 '11 at 21:05
add comment

put

alias ls="ls -l"

in your ~/.bashrc file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.