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

Re: can I list just the directories, executables?

*- On 19 Oct, Colin Marquardt wrote about "Re: can I list just the directories, executables?"
> * jh  <thedoghouse@sunvalley.net> writes:
>> Hi. I would like to know if there is a command that will list just
>> directories? 
> Do a 
>   man ls
> There, press / (for searching in the manual).
> Type -d (the text to search).
> Type n twice (for next occurence of the searchtext).
> See? The option -d is it.

I don't think this is what is wanted.  -d just keeps ls from listing the
conents of the directory when you specify the directory name on the
command line.

To list just the directories in the current directory you can do

find . -type d -maxdepth 1  

or you can feed the output to ls to format it better

find . -type d -maxdepth 1 | xargs ls -d

and add other args to ls as needed.

>> Also, is there a command that will list executable files. I just got debian
>> installed from floppy so there is not too much on my system. The only
>> fairly interesting program that I have discovered is ae (I think it stands
>> for anthony's editor) I have not figured out how to use it, it's pretty
>> arcane. 
> If your shell is the bash (as I suppose), just press the TAB key
> twice. You´ll get a big list of executables in your path. (You can
> see what your path is by typing "echo $PATH" (without the quotes).

Again find can help here:

find . -type f -perm +1


Brian Servis
Mechanical Engineering              |  Never criticize anybody until you  
Purdue University                   |  have walked a mile in their shoes,
servis@purdue.edu                   |  because by that time you will be a
http://www.ecn.purdue.edu/~servis   |  mile away and have their shoes.

Reply to: