Can you sort ls listing by name? Amazingly enough (Or I must be brain-dead) I dont see anything in man pages or can find anything on google :)
My Bad ... I was brain-dead indeed! ... Thanks Nobert Hartl, tvanfosson and Evert :)
Devang Kamdar
2009-05-19 08:48:03
+1
A:
From the man page (for bash ls):
Sort entries alphabetically if none of -cftuSUX nor --sort.
jwoolard
2009-05-18 15:19:57
@Norbert: You are correct, but `which ls` would succeed even if bash had a builtin ls. Rather, do `builtin ls` in bash, and get an error.
Pianosaurus
2009-05-18 15:42:07
@Norbert: `which` always returns a path. Use `type ls` to determine what the shell thinks `ls` is (built-in, function, executable).
ephemient
2009-05-18 17:52:04
+4
A:
For something simple, you can combine ls with sort. For just a list of file names:
ls -1 | sort
To sort them in reverse order:
ls -1 | sort -r
Mark
2009-05-18 15:22:12
A:
NOTICE: "a" comes AFTER "Z":
$ touch A.txt aa.txt Z.txt
$ ls
A.txt Z.txt aa.txt
russian_spy
2009-10-30 21:02:55