Question : ls recursive when -R not requested

I admit that I'm quite new to Linux, but I'm getting results from the "ls" command that I do not expect.  It seems to want to do a recursive search when I don't specify the "-R" parameter.  Is there any way to convince "ls" that I only want to see the results for the particular directory level that I am in, even if there are sub-directories that match the file name pattern I'm searching for?

For example, in my /tmp directory, if I have multiple *.txt files including: paul.txt and peter.xt and have a sub-directory named: printed.  If I do:
cd /tmp
then
ls -l p*

it shows me the two files I expect to see, but then insists on descending into the "printed" directory and listing everything there.

I have Red Hat Linux AS4.  I don't know if this behaviour is unique to Linux, or to Red Hat, or unique to AS4 or maybe unique to the bash shell?  Is this the expected behaviour for the "ls" command in the bash shell?

Answer : ls recursive when -R not requested

I misread your original post.  You were looking for *.txt, but your command was 'ls -l p*'.
The directory named 'printed' matches the wildcard pattern 'p*' so it gets listed recursively.
That is the designed behaviour - no mysterious aliasing going on here.  

Try 'ls -ld p*' instead. The -d switch tells ls to list directories as themselves, not their contents.
It will still list 'printed' in the output though (since it matches 'p*').  But it will not list the
contents of 'printed'.

Random Solutions  
 
programming4us programming4us