I like rknichols explanation. It's better than mine, but i'll try to make up for it with a lack of brevity...
I don't have formal knowledge of this and probably don't have the terms right, but it's easy enough to do a few experiments and comment on them.
Just an 'ls' command shows the contents of the current directory.
Code:
[root@athlon ~]# ls -F
anaconda-ks.cfg install.log.syslog test tlpi-book/
home.iso ps_mem.py* tlpi-110706-book.tar.gz
install.log swap* tlpi-110706-dist.tar.gz
(The '-F' flag is just to tag an indicator onto the end of each directory entry listed: * is executable; / is a directory.)
When you list with an asterisk, 'ls *', it lists the current directory and goes one level deeper.
Code:
[root@athlon ~]# ls -F *
anaconda-ks.cfg install.log.syslog test
home.iso ps_mem.py* tlpi-110706-book.tar.gz
install.log swap* tlpi-110706-dist.tar.gz
tlpi-book:
acl/ filesys/ Makefile.inc.Tru64 psem/ syslim/
altio/ getopt/ memalloc/ pshm/ threads/
BUILDING inotify/ mmap/ pty/ time/
cap/ lib/ pgsjc/ README timers/
CHANGES libtlpi.a pipes/ shlibs/ tty/
COPYING loginacct/ pmsg/ signals/ users_groups/
daemons/ Makefile proc/ sockets/ vmem/
dirs_links/ Makefile.inc proccred/ svipc/ xattr/
filebuff/ Makefile.inc.FreeBSD procexec/ svmsg/
fileio/ Makefile.inc.HP-UX procpri/ svsem/
filelock/ Makefile.inc.MacOSX procres/ svshm/
files/ Makefile.inc.Solaris progconc/ sysinfo/
With a slash appended to a filename, it means "directory". (Like if you did a 'cp file directory/', it won't make a copy of "file" and call it "directory"; instead the slash forces 'cp' to make a file and place it into a directory called "directory".)
So 'ls */' says list off anything (*), but only if it is a directory (and go one level deep). So here we just get the contents of directory "tlpi-book".
Code:
[root@athlon ~]# ls -F */
acl/ filesys/ Makefile.inc.Tru64 psem/ syslim/
altio/ getopt/ memalloc/ pshm/ threads/
BUILDING inotify/ mmap/ pty/ time/
cap/ lib/ pgsjc/ README timers/
CHANGES libtlpi.a pipes/ shlibs/ tty/
COPYING loginacct/ pmsg/ signals/ users_groups/
daemons/ Makefile proc/ sockets/ vmem/
dirs_links/ Makefile.inc proccred/ svipc/ xattr/
filebuff/ Makefile.inc.FreeBSD procexec/ svmsg/
fileio/ Makefile.inc.HP-UX procpri/ svsem/
filelock/ Makefile.inc.MacOSX procres/ svshm/
files/ Makefile.inc.Solaris progconc/ sysinfo/
Now if you use the '-l' flag, you would get a long listing - typically with mode, owner, group, size, date.
Code:
[root@athlon ~]# ls -Fl */
total 420
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 acl/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 altio/
-rw-r--r--. 1 1000 1000 4911 Sep 1 2010 BUILDING
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 cap/
-rw-r--r--. 1 1000 1000 1677 Jul 6 07:45 CHANGES
-rw-r--r--. 1 1000 1000 34520 Mar 27 2010 COPYING
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 daemons/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 dirs_links/
drwxr-xr-x. 2 1000 1000 4096 Jul 6 07:47 filebuff/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 fileio/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 filelock/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 files/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 filesys/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 getopt/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 inotify/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 lib/
-rw-r--r--. 1 root root 162616 Aug 9 20:16 libtlpi.a
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 loginacct/
-rw-r--r--. 1 1000 1000 835 Jul 6 07:38 Makefile
-rw-r--r--. 1 1000 1000 704 Sep 13 2010 Makefile.inc
-rw-r--r--. 1 1000 1000 323 Feb 22 2010 Makefile.inc.FreeBSD
-rw-r--r--. 1 1000 1000 462 Feb 22 2010 Makefile.inc.HP-UX
-rw-r--r--. 1 1000 1000 318 Mar 27 2010 Makefile.inc.MacOSX
-rw-r--r--. 1 1000 1000 415 Feb 22 2010 Makefile.inc.Solaris
-rw-r--r--. 1 1000 1000 377 Feb 22 2010 Makefile.inc.Tru64
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 memalloc/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 mmap/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:16 pgsjc/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 pipes/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 pmsg/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 proc/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 proccred/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 procexec/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 procpri/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 procres/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 progconc/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 psem/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 pshm/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 pty/
-rw-r--r--. 1 1000 1000 4300 Jan 17 2011 README
drwxr-xr-x. 5 1000 1000 4096 Aug 9 20:17 shlibs/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 signals/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 sockets/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 svipc/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 svmsg/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 svsem/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 svshm/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 sysinfo/
drwxr-xr-x. 2 1000 1000 4096 Jul 6 07:47 syslim/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 threads/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 time/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 timers/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 tty/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 users_groups/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 vmem/
drwxr-xr-x. 2 1000 1000 4096 Aug 9 20:17 xattr/
And if you use the '-d' flag, it lists the directory, not its contents. From 'man ls',
Quote:
-d, --directory
list directory entries instead of contents, and do not derefer
ence symbolic links
|
Code:
[root@athlon ~]# ls -Fld */
drwxr-xr-x. 46 1000 1000 4096 Aug 9 20:16 tlpi-book//
This explanation is pretty unscientific, but it illustrates your question for others that might be reading this post.