[cs631apue] Midterm Question

Jan Schaumann jschauma at stevens.edu
Thu Sep 20 21:14:53 EDT 2012


tparisi <tparisi at stevens.edu> wrote:

> I was wondering why the -d and -R flags aren't listed as conflicting.
> The -d flag says that Directories are listed as plain files and not  
> recursively searched.  The -R flag is for recursively searching the  
> subdirectories.

Yes, those two are in fact opposite and conflicting.  The last specified
option should take effect.

>  The real "ls" command has -d on by default.

That is not correct.  ls(1), by default, does neither '-d' nor '-R'.

Observe the difference in behaviour when you run

ls -d /var
ls -R /var
ls /var

That is, ls(1), by default lists contents of the given directory, but
does not recurse through sub directories.  This is different from the
behaviour of '-d', which does not list contents of the given directory,
but just the directory.

-Jan


More information about the cs631apue mailing list