--------------------------------------------------------------------------------
ls list filenames
--------------------------------------------------------------------------------

Next only to cd this is the most used command. Is there any thing to know
more about this command?!

Here are some useful options

-d  list directories but not their contents
-l  long format (permissions, #links, user, group, szie, date+time, name
-p   mark directories with "/"
-m  list comma separated filenames
-1  list in column (1 per line)
-r  list subdirectories recursively
-A  list all files including those starting with . (excluding, . and ..)
-F  append file type ("@","/","*","|","=",">") to the filename
-h  show size in kB,MB,GB instead of 512-byte blocks

$ ls -ltr  .. long format (l) listing reverse (t) time sort (t)
$ ls -lS ...  long format listing sorted by size of file
$ ls -ltu ... long format listing sorted by last access to file
$ ls -ltu | head  #show last 10 files that were accessed.

---------------------------------------
I. List files with or without recursion
---------------------------------------

$ ls          #no recursion
$ ls -1 

$ ls *        #recursion
$ ls -1 * 

----------------------------------------
II. List only directories
----------------------------------------

The traditional solution is 
$ ls -d */     #but this adds another "/"
		#can be cured with 
$ ls -d */ | sed 's/..$//'   

A much simpler alternative is

$ ls -F | grep "/"
$ ls -F | grep /     #further simplified!

------------------------------------------
III. List files that are not directories
------------------------------------------

$ ls -F | grep -v /

----------------------------------------
IV. List hidden files 
----------------------------------------
Many crucial files such as .bashrc are hidden and do not show up with
ls invocation

$ ls -a  or ls -A

However, this lists all the files. If you want to only see the
hidden files then

$ ls -a | grep "^\."


----------------------------------------
V. List files by size, total size
----------------------------------------

A quick way to determine the total size of the directory is

$ ls -l | head -1

List files ordered by size

$ ls -lS       #decreasing size
$ ls -lSr      #increasing size

----------------------------------------
VI. List files: one row or one column
----------------------------------------

$ ls -1  *                 #list files in a single column
$ ls -m  * (or filename)   #filenames in a single row but comma separated

-----------------------------------------------------
IV. List full names
-----------------------------------------------------

Occasionally you want to know the full pathname

$ find $PWD     	         #to list all filenames in current directory
$ find $PWD/specific_filename    #to list full filename 

Alternatively
$ ls -d $PWD/specific_filename 


The bit below for UNIX geeks 
------------------------------------------------------------------------
mimic ls -m
--------------------------------------------------------------------------------
$ ls -1 *.* | tr '\n' ',' | gsed 's/,$//'       #using tr
or 
$ ls -1 *.* | tr '\n' ',' | gsed 's/,$/\n/'      
$ ls -1 *.* | sed -n '$!{H;};${x;s/\n/,/g;p;}'     #using sed