Monday, October 23, 2006

Command of the week: ! ls

Yes, this week's command is (gasp!) ls. This seemingly simple Unix command actually is very useful and efficient (especially compared to its DOS counterpart, dir). Ls simply shows the contents of a present directory (list to ls), but with options it can be very adjustable and "pliant." For example, ls -l lists files in the directory and their accessibiltiy conditions, like this:


drwx------ 2 users 4096 Nov 2 19:51 mail/
drwxr-s--- 35 www 32768 Jan 20 22:39 public_html/
-rw------- 1 users 3 Nov 25 02:58 test.txt

(example from http://www.computerhope.com/unix/uls.htm)

Or, for another example, ls -a will show all hidden system files, like this:

$ (or % or >) ls -a
.cshrc .history .bash coolstuff.vi HelloWorld.c a.out
$

While........

$ ls
coolstuff.vi HelloWorld.c a.out
$

There are many other ls options. For more info. about them, do man ls at your shell prompt or go to these other sites:

Linux and UNIX ls command help / Concise chart of ls options / http://www.computerhope.com/unix/uls.htm
Ls - Wikipedia, the free encyclopedia / Wiki article about ls / http://en.wikipedia.org/wiki/Ls
Unix ls command / Technical details about ls and explanation of its useage / http://www.scism.sbu.ac.uk/law/UnixStuff/ls.html
Unix man pages : ls () / the technical man explanation of ls / http://unixhelp.ed.ac.uk/CGI/man-cgi?ls

No comments: