write one small program to do one thing right
Every unix program i've seen is a monstrosity with enough options and man/info pages to drive people insane. http://www.go2linux.org/ls-man-page
Name:
Anonymous2011-10-02 17:05
ls does do one thing and does it well. It lists files.
$ ls
file1 file2 file3 filea fileb filec
Or it can list a single file.
$ ls file1
file1
Or it can list several files.
$ ls file1 file2 filec
file1 file2 filec
But ls doesn't have to support wildcards because those are provided by the shell.
ls *
file1 file2 file3 filea fileb filec
(ls never sees the asterisk, just the files)
But what if wildcards aren't sufficient for searching and the user needs regular expressions? ls doesn't have to provide those either, because the shell provides pipes (|), and grep provides regular expressions.
$ ls | grep '^.*[1-2]$'
file1
file2
ls doesn't have to worry about saving output to a file either, because that's also provided by the shell with >.
$ ls *[a-c] > file1
$ cat file1
filea
fileb
filec
Now let's say the user wants big letters like those provided by figlet?
Want to have a program where the cow tells you your fortune?
$ cat > cowfortune
fortune | cowsay
$ chmod +x cowfortune
$ mv cowfortune ~/bin
$ cowfortune
______________________________________
/ You look like a million dollars. All \
\ green and wrinkled. /
--------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Do you get the idea? The UNIX philosophy to do one thing and do it well means that ls need not worry about every possible way to list files, and figlet, cowsay and rot13 need not know anything about listing files.
ls is an exception however, since it is THE most commonly used tool, therefore it provides some of its own conveniences like sorting, etc.
If you think Apple ][ and Commodore 64 are funner than UNIX, you're an accountant or a gamer, not a hacker, and you should probably go back to /g/.