3

I tried setting the following alias in .bashrc -

$ alias ll
alias ll='ls --color=auto --time-style=long-iso'

But the above doesn't work. I want to have the long-iso as well as descending order (date or/and time-wise) whenever I ask it to list files in CLI. Is there anyway to do that ?

The above command does give me color output but not long-iso part. Am I doing something wrong ?

I did see Set ls -l time format but doesn't help in my case :(

6

You are missing a -l to turn on the long listing format and -t to sort by modification time.

Do:

alias ll='ls -lt --color=auto --time-style=long-iso'

To include hidden files too:

alias ll='ls -alt --color=auto --time-style=long-iso'

To reverse the order of sorting, oldest first, add -r:

alias ll='ls -ltr --color=auto --time-style=long-iso'
alias ll='ls -altr --color=auto --time-style=long-iso'
  • That works but doesn't have any descending order in listing of files wth respect to the date and time. Is there a way to do that as well ? – shirish Oct 8 '16 at 21:56
  • @shirish Check my edits – heemayl Oct 8 '16 at 22:00
  • 2
    You also need -t to order by last modification time. – Stéphane Chazelas Oct 8 '16 at 22:02
  • @StéphaneChazelas Was into that, but Gilles incorporated that already. – heemayl Oct 8 '16 at 22:10
  • @Giles and @heemayi - a mistake, both seem to have -r , the first one one should not have 'r' in the flag ` -lt` – shirish Oct 9 '16 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.