bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls -d option (ls ver 4.0x)


From: Bob Proulx
Subject: Re: ls -d option (ls ver 4.0x)
Date: Wed, 31 Jan 2001 09:24:13 -0700

> When I execute the command "ls -dl" information about only the pwd is
> printed, for example here is the output of the comman when the pwd is /

> drwxr-xr-x   17 root     root         4096 Jan 30 13:02 .

That is what it is supposed to be doing.  The default directory to
list if none is specified is the current directory.  The -d option
prevents recursively listing the directory.  Therefore ls -ld lists
only attributes of the current directory.

> What I expect to see is:
> 
> drwxr-xr-x    2 root     root         4096 Jan 23 17:13 bin
> drwxr-xr-x    3 root     root         1024 Jan 30 13:02 boot
> drwxr-xr-x   11 root     root        98304 Jan 30 13:08 dev
> drwxr-xr-x   39 root     root         4096 Jan 30 17:40 etc
> drwxr-xr-x    3 root     root         4096 Dec 17 16:11 home
> drwxr-xr-x    4 root     root         4096 Jan 24 01:24 lib
> drwxr-xr-x    2 root     root        16384 Dec 17 15:48 lost+found
> drwxr-xr-x    4 root     root         4096 Dec 17 15:50 mnt
> drwxr-xr-x    2 root     root         4096 Aug 23  1999 opt
> dr-xr-xr-x   72 root     root            0 Jan 30 06:02 proc
> drwxr-x---   15 root     root         4096 Jan 31 01:13 root
> drwxr-xr-x    2 root     root         4096 Jan 24 01:23 sbin
> drwxrwxrwt   11 root     root         4096 Jan 30 23:01 tmp
> drwxr-xr-x   18 root     root         4096 Jan 23 17:12 usr
> drwxr-xr-x   21 root     root         4096 Jan 23 16:25 var

That would be the output of 'ls -l' without the -d option.  

The -d option is meant to prevent ls from listing the contents of
directories when you only wnat it to list the names of the
directories.

To understand the usefulness of the -d option try this example.
Compare the differences in the results of ls when you use the -d
option versus when you do not.

  ls -ld /etc/*.d
  ls -l /etc/*.d

For more information on unix operation I personally find the O'Reilly
nutshell handbooks to be excellent.

Hope this helps.

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]