[PLUG] ls -d does not work as it should

Steve Christiansen steveshome at comcast.net
Tue Jun 26 00:03:44 UTC 2018


On 6/25/2018 4:38 PM, Brian Stanaland wrote:

> I don't understand why this works but...
>
> ls -d */
>
> [root at li1233-197 log]# ls -d */
> anaconda/  audit/  chrony/  httpd/  rhsm/  sa/  tuned/
>
> Brian

Brilliant! It works because of shell globbing. Compare to
echo */

Steve

>
>
> On Mon, Jun 25, 2018 at 7:34 PM, John Meissen <john at meissen.org> wrote:
>
>> rshepard at appl-ecosys.com said:
>>>     What option would you use to list only subdirectories and not files
>> in the
>>> cwd or the subdirectories?
>> I generally take the easy way and just do
>>    ls -l | grep drw
>>
>> You could do
>>    find . -type d -maxdepth 1
>>
>> Or if you want it sorted,
>>    find . -type d -maxdepth 1 | sort
>>
>> Each has it's own quirks.
>>
>>
>>
>> _______________________________________________
>> PLUG mailing list
>> PLUG at pdxlinux.org
>> http://lists.pdxlinux.org/mailman/listinfo/plug
>>
>
>




More information about the PLUG mailing list