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

Re: dir /s *.* equivalent for unix.



On Mon, Jul 06, 1998 at 08:19:36PM -0700, Christopher Barry wrote:
> Hi all,
> 
> I just keeping getting all these lovely questions for you. At a console,
> if I want to search for a file or any files with a certain extension in
> the current directory and all sub directories and list them, what's the
> best way to do this? The equivalent in DOS would be "dir /s *.whatever"
> but this doesn't work with ls like "ls -R *.deb", for instance. I can do
> "ls -R | more" and then use more's search ability but this is getting
> tiring. Man page isn't too helpful either.

man -k keyword is much more usefull ;)

opk a couple of things:
1) as with most things in Unix-like systems...there is more than
1 way to do this...in fact...there are probably 10 or 20 ways
(SideNote: someone in debian-devel a few weeks ago made a comment
about differnt ways to find the current UID of a person exectuting
a shell script...amzing how many ways it can be done)

2) The "file extension" is only as usefull as you trust it ;)
unlike most DOS applications, it is rather uncommon for an application
in a Unix-like environment to make assumptions based on filenames.

3) check out: find, locate, grep
check this out...lets say I am looking for .jpg files throughout my
entire system:
$ locate .jpg
/usr/doc/dhelp/debian.jpg
/usr/doc/info2www/infodoc.jpg

now lets say I am in /usr/doc/dhelp and ONLY want ones "under" that
directory:
$ locate .jpg|grep `pwd`
/usr/doc/dhelp/debian.jpg

thats just my creative solution... I am sure there are many others
(why is it I can never think of that when I actually need to 
use it?)

anyone else got some ways?

-Steve


--  
Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: