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

Re: can I list just the directories, executables?

On 19 Oct, Brian Servis wrote:
> *- 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? 

>> See? The option -d is it.

> 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.

Or if one absolutely insists on using ls one can do

ls -F | grep '/'

the -F option adds / to the end of the dirnames, * after exe's, @ after
symlinks - and probably some more that I've forgotten... (| for named pipes?)

>>> Also, is there a command that will list executable files. 
>> 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

Per above:

ls -F | grep '*'

it is a bit unvieldy if you want to use the output for something else
since it adds that extra character to the name...

                  Linux: Turn on...Tune in...Fork out...

Reply to: