Plz tell me the cmd of viewing only directories. Suppose i am at bin directory and it contains another directory mails with lotz of files in it.
Now when ever I do ls -lt mails under bin directory it shows me all the files inside mails dir . But I just want to see only mails dir as an output not all of its contents(i.e files inside mails dir). Is there any switch for displaying directories only.
Plz let me know. I would be thankful. I am working on Solaris 5.8 platform.
The given alias is quite ok for listings of the $PWD.
But if I remember correctly aliases (or better alii) are parameter ignorant.
If you wish to pass parameters you need to define a shell function.
For instance you could put this in your .shrc file.
Of course the classic way to list directories is simply to use find
e.g. for a recursive search
find /var -type d
But you could restrict the descent to inodes of the same filesystem
find /var -xdev -type d
Or even limit the depth of descent
find /var -maxdepth 1 -type d
But better consult your Unix's manpage of find because despite
a common denominator the different finds all deviate slightly in their scope and syntax.
Probably the widest functionality is offered by GNU find,
as is part of findutils of Linux distros.
Note also, if you run find with restricted permissions as far as read and execute
of dirs is concerned that it's probably advisable to redirect stderr to /dev/null
to prevent error messages cluttering your find results.
Perhaps I was uttering imprecisely
(but as I am not a native English speaker this may excuse me)
The kind of alias you were mentioning like the notorious RedHat ls alias
(which I detest because it regularily spoils my aixterm, from where I log in to an RH box)
I would not really consider parameter processing like that of shell functions.
I think what the shell does here is simply a word splitting of tokens first,
and then the alias expansion before finally evaluating the whole expression.